pub struct StaticConfig { /* private fields */ }Expand description
Persistent L2 geometry and fixed-index sizing.
These values define the static disk identity. A clean image created with a different static configuration is discarded and the cache starts empty.
Implementations§
Source§impl StaticConfig
impl StaticConfig
Sourcepub fn new(capacity_bytes: u64) -> Self
pub fn new(capacity_bytes: u64) -> Self
Creates static L2 geometry and sizes its index assuming an average 16 KiB live entry.
capacity_bytes is the total Region extent, excluding the data
superblock, state, and clean-image files. The default Region size is
32 MiB. A default plan above 4 TiB exceeds the supported index size and
fails validation; use Self::with_expected_entries when a larger
average entry permits a smaller explicit index. Use
Self::peak_disk_bytes for the cache-owned logical disk bound.
Sourcepub fn with_region_size_bytes(self, bytes: u64) -> Self
pub fn with_region_size_bytes(self, bytes: u64) -> Self
Sets the Region size in bytes.
Valid sizes are 4 KiB multiples through 32 MiB. L2 capacity is an exact multiple containing at least two Regions. A complete encoded record fits in one Region. Every append shard eagerly owns two Region-sized staging buffers.
Sourcepub fn with_expected_entries(self, entries: usize) -> Self
pub fn with_expected_entries(self, entries: usize) -> Self
Sizes the fixed L2 index for the expected number of simultaneously live keys.
This counts simultaneously live keys. The resulting index uses roughly two physical buckets per expected live key and is part of the static disk identity.
Sourcepub const fn capacity_bytes(&self) -> u64
pub const fn capacity_bytes(&self) -> u64
Returns the total Region extent in bytes.
Sourcepub const fn region_size_bytes(&self) -> u64
pub const fn region_size_bytes(&self) -> u64
Returns the Region size in bytes.
Sourcepub const fn index_slots(&self) -> usize
pub const fn index_slots(&self) -> usize
Returns the fixed number of physical L2 index slots.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates the static physical geometry before opening cache files.
Sourcepub fn peak_disk_bytes(&self) -> Result<u64>
pub fn peak_disk_bytes(&self) -> Result<u64>
Maximum cache-owned logical disk bytes after a successful open.
The bound includes the fixed data and state files plus both the current clean image and the temporary image used for atomic warm publication. Filesystem metadata and block-allocation granularity are outside it.
Trait Implementations§
Source§impl Clone for StaticConfig
impl Clone for StaticConfig
Source§fn clone(&self) -> StaticConfig
fn clone(&self) -> StaticConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more