pub struct BlobIndex { /* private fields */ }Expand description
Point-lookup RocksDB index over content-addressed blob entries.
Blob entries (16-byte hash keys) live in the index column family. A
small set of maintenance keys (the per-segment durable lengths) live in
the implicit default column family instead, so a meta key can never
collide with a hash key and a full index scan yields exactly the blob
entries.
Implementations§
Source§impl BlobIndex
impl BlobIndex
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, StorageError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, StorageError>
Open (creating if missing) the blob index at path with
RocksDbTuning::blob_index.
Sourcepub fn open_with_tuning(
path: impl AsRef<Path>,
tuning: RocksDbTuning,
) -> Result<Self, StorageError>
pub fn open_with_tuning( path: impl AsRef<Path>, tuning: RocksDbTuning, ) -> Result<Self, StorageError>
Open the blob index with explicit tuning (tests and benchmarks).
Sourcepub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
pub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
Get one key, or None if absent.
Sourcepub fn multi_get(
&self,
keys: &[&[u8]],
) -> Result<Vec<Option<Vec<u8>>>, StorageError>
pub fn multi_get( &self, keys: &[&[u8]], ) -> Result<Vec<Option<Vec<u8>>>, StorageError>
Positional batched point lookup; None marks a missing key.
Values are copied once out of RocksDB’s pinned MultiGet batch; the
pins are released before this returns. keys need not be sorted:
RocksDB sorts the batch internally.
Sourcepub fn get_meta(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
pub fn get_meta(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StorageError>
Get one maintenance key from the default column family.
Sourcepub fn iter_entries(&self) -> Iter<'_>
pub fn iter_entries(&self) -> Iter<'_>
Iterate every blob entry (hash key → tagged value) in index order.
Meta keys are excluded — they live in the default column family —
so a full walk of this iterator is exactly the blob entry set
(waratah blob verify).
Sourcepub fn write_batch(&self) -> BlobIndexBatch
pub fn write_batch(&self) -> BlobIndexBatch
Start an atomic write batch against the index.
Sourcepub fn flush(&self) -> Result<(), StorageError>
pub fn flush(&self) -> Result<(), StorageError>
Flush the MemTables to SST files and wait for completion. Covers
both column families: the blob entries and the default
maintenance keys (per-segment durable lengths) — leaving the
maintenance keys unflushed would make them WAL-replay-only forever.
Sourcepub fn compact(&self)
pub fn compact(&self)
Full-range compaction of both column families (blob entries and
the default maintenance keys).
Sourcepub fn block_cache_bytes(&self) -> Option<(u64, u64)>
pub fn block_cache_bytes(&self) -> Option<(u64, u64)>
This DB’s block-cache (capacity, used) bytes, for metrics.