pub struct MemoryIndex { /* private fields */ }Expand description
Canonical in-memory IndexBackend: a flat map from block identity to
residency. This is the reference backend and the baseline that persistent
backends (Holt/ART, RocksDB/LSM, filesystem) are compared against in
Experiment mode. It reports bytes_written = 0 because nothing is persisted.
Implementations§
Source§impl MemoryIndex
impl MemoryIndex
Trait Implementations§
Source§impl Debug for MemoryIndex
impl Debug for MemoryIndex
Source§impl Default for MemoryIndex
impl Default for MemoryIndex
Source§fn default() -> MemoryIndex
fn default() -> MemoryIndex
Returns the “default value” for a type. Read more
Source§impl IndexBackend for MemoryIndex
impl IndexBackend for MemoryIndex
Source§fn name(&self) -> &str
fn name(&self) -> &str
Stable backend name for reports (for example “memory”, “holt”, “rocksdb”).
Source§fn put(&mut self, residency: CacheResidency)
fn put(&mut self, residency: CacheResidency)
Insert or update a residency record for a block on a worker/tier.
Source§fn locate(&self, key: &KvBlockKey) -> Vec<CacheResidency>
fn locate(&self, key: &KvBlockKey) -> Vec<CacheResidency>
Every residency for an exact block identity. A block may be resident on
several workers or tiers at once.
Source§fn prefix_scan(
&self,
scope: &IdentityScope,
prefix_hash: &str,
) -> Vec<CacheResidency>
fn prefix_scan( &self, scope: &IdentityScope, prefix_hash: &str, ) -> Vec<CacheResidency>
Identity-aware prefix scan: residencies whose block belongs to
scope
and whose prefix_hash equals prefix_hash. This is the lookup where
radix/ART backends are expected to beat flat maps and LSM stores.Source§fn remove_block(
&mut self,
scope: &IdentityScope,
worker_id: &str,
block_hash: &str,
) -> usize
fn remove_block( &mut self, scope: &IdentityScope, worker_id: &str, block_hash: &str, ) -> usize
Remove a single block (by content hash, within an identity scope) from a
worker. Returns the number of residency records removed.
Source§fn clear_worker(&mut self, worker_id: &str)
fn clear_worker(&mut self, worker_id: &str)
Drop everything resident on one worker/engine (for
AllBlocksCleared or
worker loss).Source§fn snapshot(&self) -> Vec<CacheResidency>
fn snapshot(&self) -> Vec<CacheResidency>
Full residency snapshot, for debugging and for routers that consume a
slice of residency.
Source§fn metrics(&self) -> IndexMetrics
fn metrics(&self) -> IndexMetrics
Comparable backend metrics (see
IndexMetrics). The default derives
resident_blocks/resident_bytes from a snapshot; persistent backends
should override to also report bytes_written and counters.fn is_empty(&self) -> bool
Source§fn persistent(&self) -> bool
fn persistent(&self) -> bool
Whether this backend persists residency across process restarts. The
in-memory reference backend returns
false; Holt (ART), RocksDB (LSM),
and filesystem backends return true. Drives recovery experiments and is
surfaced in reports.Auto Trait Implementations§
impl Freeze for MemoryIndex
impl RefUnwindSafe for MemoryIndex
impl Send for MemoryIndex
impl Sync for MemoryIndex
impl Unpin for MemoryIndex
impl UnsafeUnpin for MemoryIndex
impl UnwindSafe for MemoryIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more