pub struct BlobTree { /* private fields */ }
Expand description
A key-value-separated log-structured merge tree
This tree is a composite structure, consisting of an index tree (LSM-tree) and a log-structured value log to reduce write amplification.
See https://docs.rs/value-log for more information.
Implementations§
Source§impl BlobTree
impl BlobTree
pub fn apply_gc_strategy( &self, strategy: &impl GcStrategy<MyBlobCache, MyCompressor>, seqno: SeqNo, ) -> Result<u64>
Trait Implementations§
Source§impl AbstractTree for BlobTree
impl AbstractTree for BlobTree
Source§fn major_compact(&self, target_size: u64, seqno_threshold: SeqNo) -> Result<()>
fn major_compact(&self, target_size: u64, seqno_threshold: SeqNo) -> Result<()>
Performs major compaction, blocking the caller until it’s done. Read more
Source§fn clear_active_memtable(&self)
fn clear_active_memtable(&self)
Clears the active memtable atomically.
Source§fn l0_run_count(&self) -> usize
fn l0_run_count(&self) -> usize
Returns the amount of disjoint runs in L0. Read more
Source§fn blob_file_count(&self) -> usize
fn blob_file_count(&self) -> usize
Returns the amount of blob files currently in the tree.
Source§fn size_of<K: AsRef<[u8]>>(
&self,
key: K,
seqno: Option<SeqNo>,
) -> Result<Option<u32>>
fn size_of<K: AsRef<[u8]>>( &self, key: K, seqno: Option<SeqNo>, ) -> Result<Option<u32>>
Returns the size of a value if it exists. Read more
Source§fn bloom_filter_size(&self) -> usize
fn bloom_filter_size(&self) -> usize
Gets the memory usage of all bloom filters in the tree.
Source§fn sealed_memtable_count(&self) -> usize
fn sealed_memtable_count(&self) -> usize
Returns the amount of sealed memtables.
Source§fn keys(
&self,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Box<dyn DoubleEndedIterator<Item = Result<UserKey>> + 'static>
fn keys( &self, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Box<dyn DoubleEndedIterator<Item = Result<UserKey>> + 'static>
Returns an iterator that scans through the entire tree, returning keys only. Read more
Source§fn values(
&self,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Box<dyn DoubleEndedIterator<Item = Result<UserValue>> + 'static>
fn values( &self, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Box<dyn DoubleEndedIterator<Item = Result<UserValue>> + 'static>
Returns an iterator that scans through the entire tree, returning values only. Read more
Source§fn flush_memtable(
&self,
segment_id: SegmentId,
memtable: &Arc<Memtable>,
eviction_seqno: SeqNo,
) -> Result<Option<Segment>>
fn flush_memtable( &self, segment_id: SegmentId, memtable: &Arc<Memtable>, eviction_seqno: SeqNo, ) -> Result<Option<Segment>>
Synchronously flushes a memtable to a disk segment. Read more
Source§fn register_segments(&self, segments: &[Segment]) -> Result<()>
fn register_segments(&self, segments: &[Segment]) -> Result<()>
Atomically registers flushed disk segments into the tree, removing their associated sealed memtables. Read more
Source§fn lock_active_memtable(&self) -> RwLockWriteGuard<'_, Arc<Memtable>>
fn lock_active_memtable(&self) -> RwLockWriteGuard<'_, Arc<Memtable>>
Write-locks the active memtable for exclusive access
Source§fn set_active_memtable(&self, memtable: Memtable)
fn set_active_memtable(&self, memtable: Memtable)
Sets the active memtable. Read more
Source§fn add_sealed_memtable(&self, id: u64, memtable: Arc<Memtable>)
fn add_sealed_memtable(&self, id: u64, memtable: Arc<Memtable>)
Adds a sealed memtables. Read more
Source§fn compact(
&self,
strategy: Arc<dyn CompactionStrategy>,
seqno_threshold: SeqNo,
) -> Result<()>
fn compact( &self, strategy: Arc<dyn CompactionStrategy>, seqno_threshold: SeqNo, ) -> Result<()>
Performs compaction on the tree’s levels, blocking the caller until it’s done. Read more
Source§fn get_next_segment_id(&self) -> SegmentId
fn get_next_segment_id(&self) -> SegmentId
Returns the next segment’s ID.
Source§fn tree_config(&self) -> &Config
fn tree_config(&self) -> &Config
Returns the tree config.
Source§fn get_highest_seqno(&self) -> Option<SeqNo>
fn get_highest_seqno(&self) -> Option<SeqNo>
Returns the highest sequence number.
Source§fn active_memtable_size(&self) -> u32
fn active_memtable_size(&self) -> u32
Returns the approximate size of the active memtable in bytes. Read more
Source§fn rotate_memtable(&self) -> Option<(u64, Arc<Memtable>)>
fn rotate_memtable(&self) -> Option<(u64, Arc<Memtable>)>
Seals the active memtable, and returns a reference to it.
Source§fn segment_count(&self) -> usize
fn segment_count(&self) -> usize
Returns the amount of disk segments currently in the tree.
Source§fn level_segment_count(&self, idx: usize) -> Option<usize>
fn level_segment_count(&self, idx: usize) -> Option<usize>
Returns the amount of segments in levels[idx]. Read more
Source§fn approximate_len(&self) -> usize
fn approximate_len(&self) -> usize
Approximates the amount of items in the tree.
Source§fn contains_key<K: AsRef<[u8]>>(
&self,
key: K,
seqno: Option<SeqNo>,
) -> Result<bool>
fn contains_key<K: AsRef<[u8]>>( &self, key: K, seqno: Option<SeqNo>, ) -> Result<bool>
Returns
true
if the tree contains the specified key. Read moreSource§fn len(
&self,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Result<usize>
fn len( &self, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Result<usize>
Scans the entire tree, returning the amount of items. Read more
Source§fn disk_space(&self) -> u64
fn disk_space(&self) -> u64
Returns the disk space usage.
Source§fn get_highest_memtable_seqno(&self) -> Option<SeqNo>
fn get_highest_memtable_seqno(&self) -> Option<SeqNo>
Returns the highest sequence number of the active memtable.
Source§fn get_highest_persisted_seqno(&self) -> Option<SeqNo>
fn get_highest_persisted_seqno(&self) -> Option<SeqNo>
Returns the highest sequence number that is flushed to disk.
Source§fn snapshot(&self, seqno: SeqNo) -> Snapshot
fn snapshot(&self, seqno: SeqNo) -> Snapshot
Opens a read-only point-in-time snapshot of the tree Read more
Source§fn range<K: AsRef<[u8]>, R: RangeBounds<K>>(
&self,
range: R,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Box<dyn DoubleEndedIterator<Item = Result<KvPair>> + 'static>
fn range<K: AsRef<[u8]>, R: RangeBounds<K>>( &self, range: R, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Box<dyn DoubleEndedIterator<Item = Result<KvPair>> + 'static>
Returns an iterator over a range of items. Read more
Source§fn prefix<K: AsRef<[u8]>>(
&self,
prefix: K,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Box<dyn DoubleEndedIterator<Item = Result<KvPair>> + 'static>
fn prefix<K: AsRef<[u8]>>( &self, prefix: K, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Box<dyn DoubleEndedIterator<Item = Result<KvPair>> + 'static>
Returns an iterator over a prefixed set of items. Read more
Source§fn insert<K: Into<UserKey>, V: Into<UserValue>>(
&self,
key: K,
value: V,
seqno: SeqNo,
) -> (u32, u32)
fn insert<K: Into<UserKey>, V: Into<UserValue>>( &self, key: K, value: V, seqno: SeqNo, ) -> (u32, u32)
Inserts a key-value pair into the tree. Read more
Source§fn get<K: AsRef<[u8]>>(
&self,
key: K,
seqno: Option<SeqNo>,
) -> Result<Option<UserValue>>
fn get<K: AsRef<[u8]>>( &self, key: K, seqno: Option<SeqNo>, ) -> Result<Option<UserValue>>
Retrieves an item from the tree. Read more
Source§fn remove<K: Into<UserKey>>(&self, key: K, seqno: SeqNo) -> (u32, u32)
fn remove<K: Into<UserKey>>(&self, key: K, seqno: SeqNo) -> (u32, u32)
Removes an item from the tree. Read more
Source§fn remove_weak<K: Into<UserKey>>(&self, key: K, seqno: SeqNo) -> (u32, u32)
fn remove_weak<K: Into<UserKey>>(&self, key: K, seqno: SeqNo) -> (u32, u32)
Removes an item from the tree. Read more
Source§fn is_empty(
&self,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Result<bool>
fn is_empty( &self, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Result<bool>
Returns
true
if the tree is empty. Read moreSource§fn first_key_value(
&self,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Result<Option<KvPair>>
fn first_key_value( &self, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Result<Option<KvPair>>
Returns the first key-value pair in the tree.
The key in this pair is the minimum key in the tree. Read more
Source§fn last_key_value(
&self,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Result<Option<KvPair>>
fn last_key_value( &self, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Result<Option<KvPair>>
Returns the last key-value pair in the tree.
The key in this pair is the maximum key in the tree. Read more
Source§fn iter(
&self,
seqno: Option<SeqNo>,
index: Option<Arc<Memtable>>,
) -> Box<dyn DoubleEndedIterator<Item = Result<KvPair>> + 'static>
fn iter( &self, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Box<dyn DoubleEndedIterator<Item = Result<KvPair>> + 'static>
Returns an iterator that scans through the entire tree. Read more
Source§fn snapshot_at(&self, seqno: SeqNo) -> Snapshot
fn snapshot_at(&self, seqno: SeqNo) -> Snapshot
Opens a snapshot of this partition with a given sequence number
Auto Trait Implementations§
impl Freeze for BlobTree
impl RefUnwindSafe for BlobTree
impl Send for BlobTree
impl Sync for BlobTree
impl Unpin for BlobTree
impl UnwindSafe for BlobTree
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