Skip to main content

MapSnapshot

Struct MapSnapshot 

Source
pub struct MapSnapshot<'a, S: Store> { /* private fields */ }
Expand description

An immutable, version-pinned view over one managed map snapshot.

A snapshot owns its MapVersion handle and borrows the engine. All reads stay on that tree even when another writer advances the managed map’s head. This is the preferred surface for request-scoped reads, long scans, proofs, export, and diagnostics.

Implementations§

Source§

impl<'a, S: Store> MapSnapshot<'a, S>

Source

pub fn version(&self) -> &MapVersion

Metadata and tree handle for this pinned version.

Source

pub fn id(&self) -> &MapVersionId

Stable content-derived identifier for this pinned version.

Source

pub fn tree(&self) -> &Tree

Immutable tree handle used by this snapshot.

Source

pub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>

Read one key.

Source

pub fn get_value_ref(&self, key: &[u8]) -> Result<Option<ValueRef>, Error>

Read the stored inline/blob reference without resolving blob bytes.

Source

pub fn get_large_value<B: BlobStore>( &self, blob_store: &B, key: &[u8], ) -> Result<Option<Vec<u8>>, Error>

Read one value and resolve offloaded blob content when necessary.

Source

pub fn contains_key(&self, key: &[u8]) -> Result<bool, Error>

Check whether one key exists.

Source

pub fn get_many<K: AsRef<[u8]>>( &self, keys: &[K], ) -> Result<Vec<Option<Vec<u8>>>, Error>

Read several keys while preserving caller order and duplicates.

Source

pub fn first_entry(&self) -> Result<Option<KeyValue>, Error>

Return the first entry in key order.

Source

pub fn last_entry(&self) -> Result<Option<KeyValue>, Error>

Return the last entry in key order.

Source

pub fn lower_bound(&self, key: &[u8]) -> Result<Option<KeyValue>, Error>

Return the first entry whose key is greater than or equal to key.

Source

pub fn upper_bound(&self, key: &[u8]) -> Result<Option<KeyValue>, Error>

Return the first entry whose key is strictly greater than key.

Source

pub fn range<'s>( &'s self, start: &[u8], end: Option<&[u8]>, ) -> Result<RangeIter<'s, S>, Error>

Lazily stream a half-open key range from this immutable snapshot.

Source

pub fn stream_range<'s>( &'s self, start: &[u8], end: Option<&[u8]>, ) -> Result<RangeIter<'s, S>, Error>

Explicit alias for MapSnapshot::range emphasizing lazy large scans.

Source

pub fn prefix<'s>(&'s self, prefix: &[u8]) -> Result<RangeIter<'s, S>, Error>

Lazily stream every entry under prefix.

Source

pub fn stream_prefix<'s>( &'s self, prefix: &[u8], ) -> Result<RangeIter<'s, S>, Error>

Explicit alias for MapSnapshot::prefix emphasizing lazy large scans.

Source

pub fn range_page( &self, cursor: &RangeCursor, end: Option<&[u8]>, limit: usize, ) -> Result<RangePage, Error>

Read one forward cursor page.

Source

pub fn prefix_page( &self, prefix: &[u8], cursor: &RangeCursor, limit: usize, ) -> Result<RangePage, Error>

Read one prefix-bounded forward cursor page.

Source

pub fn reverse_page( &self, cursor: &ReverseCursor, start: &[u8], limit: usize, ) -> Result<ReversePage, Error>

Read one reverse cursor page from the end of [start, +inf).

Source

pub fn prefix_reverse_page( &self, prefix: &[u8], cursor: &ReverseCursor, limit: usize, ) -> Result<ReversePage, Error>

Read one reverse cursor page inside prefix.

Source

pub fn reverse_scan( &self, start: &[u8], page_size: usize, ) -> MapReverseIter<'a, S>

Lazily scan [start, +inf) in descending key order.

page_size bounds each internal store traversal and is clamped to one.

Source

pub fn prefix_reverse_scan( &self, prefix: &[u8], page_size: usize, ) -> MapReverseIter<'a, S>

Lazily scan one prefix in descending key order.

Source

pub fn cursor_window( &self, key: &[u8], end: Option<&[u8]>, limit: usize, ) -> Result<CursorWindow, Error>

Seek to key and return a bounded forward window.

Source

pub fn stats(&self) -> Result<TreeStats, Error>

Collect structural and serialized-size statistics for this snapshot.

Source

pub fn debug_view(&self) -> Result<TreeDebugView, Error>

Return a deterministic diagnostic view grouped by tree level.

Source

pub fn prove_key(&self, key: &[u8]) -> Result<KeyProof, Error>

Build a self-contained proof of one key’s presence or absence.

Source

pub fn prove_keys<K: AsRef<[u8]>>( &self, keys: &[K], ) -> Result<MultiKeyProof, Error>

Build one shared proof for several keys.

Source

pub fn prove_range( &self, start: &[u8], end: Option<&[u8]>, ) -> Result<RangeProof, Error>

Build a complete proof for [start, end).

Source

pub fn prove_prefix(&self, prefix: &[u8]) -> Result<RangeProof, Error>

Build a complete proof for all entries under prefix.

Source

pub fn prove_range_page( &self, cursor: &RangeCursor, end: Option<&[u8]>, limit: usize, ) -> Result<ProvedRangePage, Error>

Read and prove one cursor page.

Source

pub fn authenticate_proof_bundle( &self, proof_bundle: impl Into<Vec<u8>>, secret: &[u8], authentication: ProofAuthentication, ) -> Result<AuthenticatedProofEnvelope, Error>

Authenticate canonical proof bundle bytes with HMAC-SHA256.

Source

pub fn export(&self) -> Result<SnapshotBundle, Error>

Export this tree and every reachable node as a portable verified bundle.

Source

pub fn plan_missing_nodes<D: Store>( &self, destination: &D, ) -> Result<MissingNodePlan, Error>

Plan which nodes another store is missing for this snapshot.

Source

pub fn copy_missing_nodes<D: Store>( &self, destination: &D, ) -> Result<MissingNodeCopy, Error>

Copy this snapshot’s missing nodes into another store.

Source

pub fn push_to<D>( &self, destination: &VersionedMap<'_, D>, ) -> Result<MapVersion, Error>

Copy and publish this snapshot as the head of another managed map.

Source

pub fn pin_root(&self) -> Result<usize, Error>

Pin this snapshot’s root in the engine cache.

Source

pub fn pin_path(&self, key: &[u8]) -> Result<usize, Error>

Pin the root-to-leaf path for one hot key or prefix.

Source

pub fn publish_prefix_hint(&self, prefix: &[u8]) -> Result<bool, Error>

Persist a correctness-optional hot-prefix path hint.

Source

pub fn hydrate_prefix_hint(&self, prefix: &[u8]) -> Result<bool, Error>

Hydrate the engine cache from a previously published prefix hint.

Auto Trait Implementations§

§

impl<'a, S> Freeze for MapSnapshot<'a, S>

§

impl<'a, S> RefUnwindSafe for MapSnapshot<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for MapSnapshot<'a, S>

§

impl<'a, S> Sync for MapSnapshot<'a, S>

§

impl<'a, S> Unpin for MapSnapshot<'a, S>

§

impl<'a, S> UnsafeUnpin for MapSnapshot<'a, S>

§

impl<'a, S> UnwindSafe for MapSnapshot<'a, S>
where S: RefUnwindSafe,

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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> Same for T

Source§

type Output = T

Should always be Self
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.