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.
§rdcc_w0 has nothing to decide here
C’s third field is a head start, in entries, for a rule that preempts only
chunks the caller consumed in full before the unqualified rule joins the
walk (H5D__chunk_cache_prune, discriminating on
H5D_rdcc_ent_t::rd_count / wr_count). Nothing here answers to it. This
cache holds decompressed data read from the file, so there is no dirty
chunk for wr_count to describe; and it records only whether a chunk is
held, never how much of it a caller took, so the rd_count class it would
sort by does not exist to be sorted.
What w0 exists to prevent — a scan evicting chunks for chunks it will not
ask for again — is handled here without a knob: a whole read fills the
cache and stops offering, so it has no prune for a preemption policy to
order. The field-by-field argument, including why a row window is the one
path that does evict and why recency already keeps what it needs, is in
the property-support reference.
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 more