Struct BlobTree

Source
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

Source

pub fn apply_gc_strategy( &self, strategy: &impl GcStrategy<MyBlobCache, MyCompressor>, seqno: SeqNo, ) -> Result<u64>

Trait Implementations§

Source§

impl AbstractTree for BlobTree

Source§

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)

Clears the active memtable atomically.
Source§

fn l0_run_count(&self) -> usize

Returns the amount of disjoint runs in L0. Read more
Source§

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>>

Returns the size of a value if it exists. Read more
Source§

fn bloom_filter_size(&self) -> usize

Gets the memory usage of all bloom filters in the tree.
Source§

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>

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>

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>>

Synchronously flushes a memtable to a disk segment. Read more
Source§

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>>

Write-locks the active memtable for exclusive access
Source§

fn set_active_memtable(&self, memtable: Memtable)

Sets the active memtable. Read more
Source§

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<()>

Performs compaction on the tree’s levels, blocking the caller until it’s done. Read more
Source§

fn get_next_segment_id(&self) -> SegmentId

Returns the next segment’s ID.
Source§

fn tree_config(&self) -> &Config

Returns the tree config.
Source§

fn get_highest_seqno(&self) -> Option<SeqNo>

Returns the highest sequence number.
Source§

fn active_memtable_size(&self) -> u32

Returns the approximate size of the active memtable in bytes. Read more
Source§

fn tree_type(&self) -> TreeType

Returns the tree type.
Source§

fn rotate_memtable(&self) -> Option<(u64, Arc<Memtable>)>

Seals the active memtable, and returns a reference to it.
Source§

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>

Returns the amount of segments in levels[idx]. Read more
Source§

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>

Returns true if the tree contains the specified key. Read more
Source§

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

Returns the disk space usage.
Source§

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>

Returns the highest sequence number that is flushed to disk.
Source§

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>

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>

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)

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>>

Retrieves an item from the tree. Read more
Source§

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)

Removes an item from the tree. Read more
Source§

fn is_empty( &self, seqno: Option<SeqNo>, index: Option<Arc<Memtable>>, ) -> Result<bool>

Returns true if the tree is empty. Read more
Source§

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>>

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>

Returns an iterator that scans through the entire tree. Read more
Source§

fn snapshot_at(&self, seqno: SeqNo) -> Snapshot

Opens a snapshot of this partition with a given sequence number
Source§

impl Clone for BlobTree

Source§

fn clone(&self) -> BlobTree

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<BlobTree> for AnyTree

Source§

fn from(v: BlobTree) -> AnyTree

Converts to this type from the input type.
Source§

impl TryInto<BlobTree> for AnyTree

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<BlobTree, <Self as TryInto<BlobTree>>::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.