pub struct LsmTreeMap<S, K, V>where
S: AnyBlockStorage,
K: Hash + Ord + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
V: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,{ /* private fields */ }Expand description
LSM Tree Instance.
Implementations§
Source§impl<S, K, V> LsmTreeMap<S, K, V>where
S: AnyBlockStorage,
K: Hash + Ord + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
V: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
impl<S, K, V> LsmTreeMap<S, K, V>where
S: AnyBlockStorage,
K: Hash + Ord + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
V: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
Sourcepub fn new(storage: S, settings: LsmTreeMapSettings) -> Self
pub fn new(storage: S, settings: LsmTreeMapSettings) -> Self
Create new empty tree.
Sourcepub async fn load(
storage: S,
root: Link<Root<K, V>>,
) -> Result<Self, StorageError>
pub async fn load( storage: S, root: Link<Root<K, V>>, ) -> Result<Self, StorageError>
Load Tree from root CID.
Sourcepub async fn insert(&mut self, key: K, value: V) -> Result<(), StorageError>
pub async fn insert(&mut self, key: K, value: V) -> Result<(), StorageError>
Insert/Replace key.
Sourcepub async fn remove(&mut self, key: K) -> Result<(), StorageError>
pub async fn remove(&mut self, key: K) -> Result<(), StorageError>
Remove key.
pub async fn contains_key(&self, key: &K) -> Result<bool, StorageError>
Sourcepub fn stream(
&self,
) -> impl Stream<Item = Result<(K, V), StorageError>> + use<S, K, V>
pub fn stream( &self, ) -> impl Stream<Item = Result<(K, V), StorageError>> + use<S, K, V>
Stream all tree entries.
Sourcepub fn stream_query(
&self,
start_at: Option<K>,
) -> impl Stream<Item = Result<(K, V), StorageError>> + use<S, K, V>
pub fn stream_query( &self, start_at: Option<K>, ) -> impl Stream<Item = Result<(K, V), StorageError>> + use<S, K, V>
Stream tree entries.
Sourcepub fn reverse_stream(
&self,
) -> impl Stream<Item = Result<(K, V), StorageError>> + use<S, K, V>
pub fn reverse_stream( &self, ) -> impl Stream<Item = Result<(K, V), StorageError>> + use<S, K, V>
Stream all tree entries in reverse order.
Sourcepub fn reverse_stream_query(
&self,
start_at: Option<K>,
) -> impl Stream<Item = Result<(K, V), StorageError>> + use<S, K, V>
pub fn reverse_stream_query( &self, start_at: Option<K>, ) -> impl Stream<Item = Result<(K, V), StorageError>> + use<S, K, V>
Stream tree entries in reverse order.
Sourcepub async fn store(&mut self) -> Result<OptionLink<Root<K, V>>, StorageError>
pub async fn store(&mut self) -> Result<OptionLink<Root<K, V>>, StorageError>
Store active items and return the root link.
§Guarantees
- The method detects if the collection is empty after this and accordingly returns
OptionLink::none.
Sourcepub async fn stats(&self) -> Result<LsmTreeStats, StorageError>
pub async fn stats(&self) -> Result<LsmTreeStats, StorageError>
Tree stats.
Sourcepub async fn is_empty(&self) -> Result<bool, StorageError>
pub async fn is_empty(&self) -> Result<bool, StorageError>
Whether the collection is empty.
Sourcepub async fn min_key(&self) -> Result<Option<K>, StorageError>
pub async fn min_key(&self) -> Result<Option<K>, StorageError>
Find the first (active - not tombstoned) key.
Sourcepub async fn max_key(&self) -> Result<Option<K>, StorageError>
pub async fn max_key(&self) -> Result<Option<K>, StorageError>
Find the last (active - not tombstoned) key.
Trait Implementations§
Source§impl<S, K, V> Clone for LsmTreeMap<S, K, V>
impl<S, K, V> Clone for LsmTreeMap<S, K, V>
Source§fn clone(&self) -> LsmTreeMap<S, K, V>
fn clone(&self) -> LsmTreeMap<S, K, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<S, K, V> Freeze for LsmTreeMap<S, K, V>where
S: Freeze,
impl<S, K, V> RefUnwindSafe for LsmTreeMap<S, K, V>
impl<S, K, V> Send for LsmTreeMap<S, K, V>
impl<S, K, V> Sync for LsmTreeMap<S, K, V>
impl<S, K, V> Unpin for LsmTreeMap<S, K, V>
impl<S, K, V> UnsafeUnpin for LsmTreeMap<S, K, V>where
S: UnsafeUnpin,
impl<S, K, V> UnwindSafe for LsmTreeMap<S, K, V>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more