pub struct Store<K, V> { /* private fields */ }Implementations§
Source§impl<K, V> Store<K, V>
impl<K, V> Store<K, V>
pub fn import( db: &Database, path: &Path, name: &str, version: Version, mode: Mode, kind: Kind, ) -> Result<Self>
pub fn import_cached( db: &Database, path: &Path, name: &str, version: Version, mode: Mode, kind: Kind, max_batches: u8, ) -> Result<Self>
pub fn get<'a>(&'a self, key: &'a K) -> Result<Option<Cow<'a, V>>>
pub fn is_empty(&self) -> Result<bool>
pub fn insert(&mut self, key: K, value: V)
pub fn remove(&mut self, key: K)
Sourcepub fn clear_caches(&mut self)
pub fn clear_caches(&mut self)
Clear all caches. Call after bulk removals (e.g., rollback) to prevent stale reads.
Sourcepub fn take_pending_ingest(
&mut self,
height: Height,
) -> Result<Option<Box<dyn FnOnce() -> Result<()> + Send>>>
pub fn take_pending_ingest( &mut self, height: Height, ) -> Result<Option<Box<dyn FnOnce() -> Result<()> + Send>>>
Takes buffered puts/dels and returns a closure that ingests them into the keyspace. The store is left with empty buffers, ready for the next batch.
pub fn iter(&self) -> impl Iterator<Item = (K, V)>
pub fn prefix<P: AsRef<[u8]>>( &self, prefix: P, ) -> impl DoubleEndedIterator<Item = (K, V)> + '_
pub fn approximate_len(&self) -> usize
pub fn needs(&self, height: Height) -> bool
Trait Implementations§
Source§impl<K, V> AnyStore for Store<K, V>
impl<K, V> AnyStore for Store<K, V>
fn keyspace(&self) -> &Keyspace
fn export_meta(&mut self, height: Height) -> Result<()>
fn export_meta_if_needed(&mut self, height: Height) -> Result<()>
fn name(&self) -> &'static str
fn height(&self) -> Option<Height>
fn has(&self, height: Height) -> bool
fn needs(&self, height: Height) -> bool
fn version(&self) -> Version
fn commit(&mut self, height: Height) -> Result<()>
fn reset(&mut self) -> Result<()>
Auto Trait Implementations§
impl<K, V> Freeze for Store<K, V>
impl<K, V> !RefUnwindSafe for Store<K, V>
impl<K, V> Send for Store<K, V>
impl<K, V> Sync for Store<K, V>
impl<K, V> Unpin for Store<K, V>
impl<K, V> UnsafeUnpin for Store<K, V>
impl<K, V> !UnwindSafe for Store<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