Skip to main content

qualia_core_db/bundle/stream/index/
limits.rs

1//! Resident index budgets are separate from remote logical extent.
2use crate::bundle::BundleReadLimits;
3
4#[derive(Clone, Copy, Debug)]
5pub struct IndexReadLimits {
6    pub index_bytes: usize,
7    pub entries: usize,
8    pub key_bytes: usize,
9    pub kind_bytes: usize,
10    pub meta_bytes: usize,
11    /// Conservative aggregate reservation for retained rows and live scratch.
12    /// This bounds requested storage, not allocator overhead or measured RSS.
13    pub decoded_index_bytes: usize,
14}
15impl From<BundleReadLimits> for IndexReadLimits {
16    fn from(l: BundleReadLimits) -> Self {
17        Self {
18            index_bytes: l.index_bytes,
19            entries: l.entries,
20            key_bytes: l.key_bytes,
21            kind_bytes: l.kind_bytes,
22            meta_bytes: l.meta_bytes,
23            decoded_index_bytes: l.decoded_index_bytes,
24        }
25    }
26}
27impl Default for IndexReadLimits {
28    fn default() -> Self {
29        BundleReadLimits::default().into()
30    }
31}
32
33#[derive(Clone, Copy, Debug)]
34pub struct ExtentLimit {
35    pub max_logical_bytes: u64,
36}
37impl Default for ExtentLimit {
38    fn default() -> Self {
39        Self {
40            max_logical_bytes: 1 << 40,
41        }
42    }
43}