pub struct ChunkCacheConfig { /* private fields */ }Expand description
Configuration for a per-dataset chunk cache.
The byte and slot limits are the hdf5-pure counterpart of the
rdcc_nbytes and rdcc_nslots raw-data chunk-cache settings from HDF5’s
H5Pset_cache. They apply to decompressed raw chunk data. The optional
chunk-index cache controls whether hdf5-pure retains the parsed chunk
address index between reads of the same crate::Dataset. Disabling the
index cache lowers retained metadata memory at the cost of re-scanning the
on-disk chunk index for repeated reads.
Implementations§
Source§impl ChunkCacheConfig
impl ChunkCacheConfig
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a config matching the historical defaults: 1 MiB of decompressed chunks, 16 slots, and retained parsed chunk indexes.
Sourcepub const fn from_h5p_cache(rdcc_nslots: usize, rdcc_nbytes: usize) -> Self
pub const fn from_h5p_cache(rdcc_nslots: usize, rdcc_nbytes: usize) -> Self
Create a config from HDF5 H5Pset_cache raw data chunk-cache values.
rdcc_nslots maps to the maximum retained chunk slots and
rdcc_nbytes maps to the maximum retained decompressed chunk bytes.
Modern HDF5 ignores H5Pset_cache’s mdc_nelmts; use
crate::MetadataCacheConfig for the metadata-cache budget. The
rdcc_w0 preemption policy has no direct equivalent because this
read-only cache uses strict LRU eviction.
Sourcepub const fn with_max_bytes(self, max_bytes: usize) -> Self
pub const fn with_max_bytes(self, max_bytes: usize) -> Self
Set the maximum decompressed chunk bytes retained per dataset.
Sourcepub const fn with_max_slots(self, max_slots: usize) -> Self
pub const fn with_max_slots(self, max_slots: usize) -> Self
Set the maximum number of decompressed chunk slots retained per dataset.
Sourcepub const fn with_index_cache(self, enabled: bool) -> Self
pub const fn with_index_cache(self, enabled: bool) -> Self
Enable or disable retaining the parsed chunk index between reads.
Sourcepub const fn max_bytes(&self) -> usize
pub const fn max_bytes(&self) -> usize
Return the maximum decompressed chunk bytes retained per dataset.
Sourcepub const fn max_slots(&self) -> usize
pub const fn max_slots(&self) -> usize
Return the maximum decompressed chunk slots retained per dataset.
Sourcepub const fn index_cache_enabled(&self) -> bool
pub const fn index_cache_enabled(&self) -> bool
Return whether parsed chunk indexes are retained between reads.
Trait Implementations§
Source§impl Clone for ChunkCacheConfig
impl Clone for ChunkCacheConfig
Source§fn clone(&self) -> ChunkCacheConfig
fn clone(&self) -> ChunkCacheConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ChunkCacheConfig
Source§impl Debug for ChunkCacheConfig
impl Debug for ChunkCacheConfig
Source§impl Default for ChunkCacheConfig
impl Default for ChunkCacheConfig
impl Eq for ChunkCacheConfig
Source§impl PartialEq for ChunkCacheConfig
impl PartialEq for ChunkCacheConfig
Source§fn eq(&self, other: &ChunkCacheConfig) -> bool
fn eq(&self, other: &ChunkCacheConfig) -> bool
self and other values to be equal, and is used by ==.