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.
Implementations§
Trait Implementations§
Source§impl AbstractTree for BlobTree
impl AbstractTree for BlobTree
Source§fn version_free_list_len(&self) -> usize
fn version_free_list_len(&self) -> usize
Gets the length of the version free list.
Source§fn prefix<K: AsRef<[u8]>>(
&self,
prefix: K,
seqno: SeqNo,
index: Option<Arc<Memtable>>,
) -> Box<dyn DoubleEndedIterator<Item = IterGuardImpl<'_>> + '_>
fn prefix<K: AsRef<[u8]>>( &self, prefix: K, seqno: SeqNo, index: Option<Arc<Memtable>>, ) -> Box<dyn DoubleEndedIterator<Item = IterGuardImpl<'_>> + '_>
Returns an iterator over a prefixed set of items. Read more
Source§fn range<K: AsRef<[u8]>, R: RangeBounds<K>>(
&self,
range: R,
seqno: SeqNo,
index: Option<Arc<Memtable>>,
) -> Box<dyn DoubleEndedIterator<Item = IterGuardImpl<'_>> + '_>
fn range<K: AsRef<[u8]>, R: RangeBounds<K>>( &self, range: R, seqno: SeqNo, index: Option<Arc<Memtable>>, ) -> Box<dyn DoubleEndedIterator<Item = IterGuardImpl<'_>> + '_>
Returns an iterator over a range of items. Read more
Source§fn tombstone_count(&self) -> u64
fn tombstone_count(&self) -> u64
Returns the approximate number of tombstones in the tree.
Source§fn drop_range(&self, key_range: KeyRange) -> Result<()>
fn drop_range(&self, key_range: KeyRange) -> Result<()>
Drops segments that are fully contained in a given range. Read more
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 number of disjoint runs in L0. Read more
Source§fn blob_file_count(&self) -> usize
fn blob_file_count(&self) -> usize
Returns the number of blob files currently in the tree.
Source§fn size_of<K: AsRef<[u8]>>(&self, key: K, seqno: SeqNo) -> Result<Option<u32>>
fn size_of<K: AsRef<[u8]>>(&self, key: K, seqno: SeqNo) -> Result<Option<u32>>
Returns the size of a value if it exists. Read more
Source§fn filter_size(&self) -> usize
fn filter_size(&self) -> usize
Gets the space usage of all filters in the tree. Read more
Source§fn pinned_filter_size(&self) -> usize
fn pinned_filter_size(&self) -> usize
Gets the memory usage of all pinned filters in the tree.
Source§fn pinned_block_index_size(&self) -> usize
fn pinned_block_index_size(&self) -> usize
Gets the memory usage of all pinned index blocks in the tree.
Source§fn sealed_memtable_count(&self) -> usize
fn sealed_memtable_count(&self) -> usize
Returns the number of sealed memtables.
Source§fn flush_memtable(
&self,
segment_id: SegmentId,
memtable: &Arc<Memtable>,
eviction_seqno: SeqNo,
) -> Result<Option<(Segment, Option<BlobFile>)>>
fn flush_memtable( &self, segment_id: SegmentId, memtable: &Arc<Memtable>, eviction_seqno: SeqNo, ) -> Result<Option<(Segment, Option<BlobFile>)>>
Synchronously flushes a memtable to a disk segment. Read more
Source§fn register_segments(
&self,
segments: &[Segment],
blob_files: Option<&[BlobFile]>,
seqno_threshold: SeqNo,
) -> Result<()>
fn register_segments( &self, segments: &[Segment], blob_files: Option<&[BlobFile]>, seqno_threshold: SeqNo, ) -> 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) -> u64
fn active_memtable_size(&self) -> u64
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 number 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 number of segments in
levels[idx]
. Read moreSource§fn approximate_len(&self) -> usize
fn approximate_len(&self) -> usize
Approximates the number of items in the tree.
Source§fn is_empty(&self, seqno: SeqNo, index: Option<Arc<Memtable>>) -> Result<bool>
fn is_empty(&self, seqno: SeqNo, index: Option<Arc<Memtable>>) -> Result<bool>
Returns
true
if the tree is empty. Read moreSource§fn contains_key<K: AsRef<[u8]>>(&self, key: K, seqno: SeqNo) -> Result<bool>
fn contains_key<K: AsRef<[u8]>>(&self, key: K, seqno: SeqNo) -> Result<bool>
Returns
true
if the tree contains the specified key. Read moreSource§fn len(&self, seqno: SeqNo, index: Option<Arc<Memtable>>) -> Result<usize>
fn len(&self, seqno: SeqNo, index: Option<Arc<Memtable>>) -> Result<usize>
Scans the entire tree, returning the number 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 insert<K: Into<UserKey>, V: Into<UserValue>>(
&self,
key: K,
value: V,
seqno: SeqNo,
) -> (u64, u64)
fn insert<K: Into<UserKey>, V: Into<UserValue>>( &self, key: K, value: V, seqno: SeqNo, ) -> (u64, u64)
Inserts a key-value pair into the tree. Read more
Source§fn get<K: AsRef<[u8]>>(&self, key: K, seqno: SeqNo) -> Result<Option<UserValue>>
fn get<K: AsRef<[u8]>>(&self, key: K, seqno: SeqNo) -> Result<Option<UserValue>>
Retrieves an item from the tree. Read more
Source§fn remove<K: Into<UserKey>>(&self, key: K, seqno: SeqNo) -> (u64, u64)
fn remove<K: Into<UserKey>>(&self, key: K, seqno: SeqNo) -> (u64, u64)
Removes an item from the tree. Read more
Source§fn iter(
&self,
seqno: SeqNo,
index: Option<Arc<Memtable>>,
) -> Box<dyn DoubleEndedIterator<Item = IterGuardImpl<'_>> + '_>
fn iter( &self, seqno: SeqNo, index: Option<Arc<Memtable>>, ) -> Box<dyn DoubleEndedIterator<Item = IterGuardImpl<'_>> + '_>
Returns an iterator that scans through the entire tree. Read more
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