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>
impl<'a, S: Store> MapSnapshot<'a, S>
Sourcepub fn version(&self) -> &MapVersion
pub fn version(&self) -> &MapVersion
Metadata and tree handle for this pinned version.
Sourcepub fn id(&self) -> &MapVersionId
pub fn id(&self) -> &MapVersionId
Stable content-derived identifier for this pinned version.
Sourcepub fn get_value_ref(&self, key: &[u8]) -> Result<Option<ValueRef>, Error>
pub fn get_value_ref(&self, key: &[u8]) -> Result<Option<ValueRef>, Error>
Read the stored inline/blob reference without resolving blob bytes.
Sourcepub fn get_large_value<B: BlobStore>(
&self,
blob_store: &B,
key: &[u8],
) -> Result<Option<Vec<u8>>, Error>
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.
Sourcepub fn get_many<K: AsRef<[u8]>>(
&self,
keys: &[K],
) -> Result<Vec<Option<Vec<u8>>>, Error>
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.
Sourcepub fn first_entry(&self) -> Result<Option<KeyValue>, Error>
pub fn first_entry(&self) -> Result<Option<KeyValue>, Error>
Return the first entry in key order.
Sourcepub fn last_entry(&self) -> Result<Option<KeyValue>, Error>
pub fn last_entry(&self) -> Result<Option<KeyValue>, Error>
Return the last entry in key order.
Sourcepub fn lower_bound(&self, key: &[u8]) -> Result<Option<KeyValue>, Error>
pub fn lower_bound(&self, key: &[u8]) -> Result<Option<KeyValue>, Error>
Return the first entry whose key is greater than or equal to key.
Sourcepub fn upper_bound(&self, key: &[u8]) -> Result<Option<KeyValue>, Error>
pub fn upper_bound(&self, key: &[u8]) -> Result<Option<KeyValue>, Error>
Return the first entry whose key is strictly greater than key.
Sourcepub fn range<'s>(
&'s self,
start: &[u8],
end: Option<&[u8]>,
) -> Result<RangeIter<'s, S>, Error>
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.
Sourcepub fn stream_range<'s>(
&'s self,
start: &[u8],
end: Option<&[u8]>,
) -> Result<RangeIter<'s, S>, Error>
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.
Sourcepub fn prefix<'s>(&'s self, prefix: &[u8]) -> Result<RangeIter<'s, S>, Error>
pub fn prefix<'s>(&'s self, prefix: &[u8]) -> Result<RangeIter<'s, S>, Error>
Lazily stream every entry under prefix.
Sourcepub fn stream_prefix<'s>(
&'s self,
prefix: &[u8],
) -> Result<RangeIter<'s, S>, Error>
pub fn stream_prefix<'s>( &'s self, prefix: &[u8], ) -> Result<RangeIter<'s, S>, Error>
Explicit alias for MapSnapshot::prefix emphasizing lazy large scans.
Sourcepub fn range_page(
&self,
cursor: &RangeCursor,
end: Option<&[u8]>,
limit: usize,
) -> Result<RangePage, Error>
pub fn range_page( &self, cursor: &RangeCursor, end: Option<&[u8]>, limit: usize, ) -> Result<RangePage, Error>
Read one forward cursor page.
Sourcepub fn prefix_page(
&self,
prefix: &[u8],
cursor: &RangeCursor,
limit: usize,
) -> Result<RangePage, Error>
pub fn prefix_page( &self, prefix: &[u8], cursor: &RangeCursor, limit: usize, ) -> Result<RangePage, Error>
Read one prefix-bounded forward cursor page.
Sourcepub fn reverse_page(
&self,
cursor: &ReverseCursor,
start: &[u8],
limit: usize,
) -> Result<ReversePage, Error>
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).
Sourcepub fn prefix_reverse_page(
&self,
prefix: &[u8],
cursor: &ReverseCursor,
limit: usize,
) -> Result<ReversePage, Error>
pub fn prefix_reverse_page( &self, prefix: &[u8], cursor: &ReverseCursor, limit: usize, ) -> Result<ReversePage, Error>
Read one reverse cursor page inside prefix.
Sourcepub fn reverse_scan(
&self,
start: &[u8],
page_size: usize,
) -> MapReverseIter<'a, S> ⓘ
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.
Sourcepub fn prefix_reverse_scan(
&self,
prefix: &[u8],
page_size: usize,
) -> MapReverseIter<'a, S> ⓘ
pub fn prefix_reverse_scan( &self, prefix: &[u8], page_size: usize, ) -> MapReverseIter<'a, S> ⓘ
Lazily scan one prefix in descending key order.
Sourcepub fn cursor_window(
&self,
key: &[u8],
end: Option<&[u8]>,
limit: usize,
) -> Result<CursorWindow, Error>
pub fn cursor_window( &self, key: &[u8], end: Option<&[u8]>, limit: usize, ) -> Result<CursorWindow, Error>
Seek to key and return a bounded forward window.
Sourcepub fn stats(&self) -> Result<TreeStats, Error>
pub fn stats(&self) -> Result<TreeStats, Error>
Collect structural and serialized-size statistics for this snapshot.
Sourcepub fn debug_view(&self) -> Result<TreeDebugView, Error>
pub fn debug_view(&self) -> Result<TreeDebugView, Error>
Return a deterministic diagnostic view grouped by tree level.
Sourcepub fn prove_key(&self, key: &[u8]) -> Result<KeyProof, Error>
pub fn prove_key(&self, key: &[u8]) -> Result<KeyProof, Error>
Build a self-contained proof of one key’s presence or absence.
Sourcepub fn prove_keys<K: AsRef<[u8]>>(
&self,
keys: &[K],
) -> Result<MultiKeyProof, Error>
pub fn prove_keys<K: AsRef<[u8]>>( &self, keys: &[K], ) -> Result<MultiKeyProof, Error>
Build one shared proof for several keys.
Sourcepub fn prove_range(
&self,
start: &[u8],
end: Option<&[u8]>,
) -> Result<RangeProof, Error>
pub fn prove_range( &self, start: &[u8], end: Option<&[u8]>, ) -> Result<RangeProof, Error>
Build a complete proof for [start, end).
Sourcepub fn prove_prefix(&self, prefix: &[u8]) -> Result<RangeProof, Error>
pub fn prove_prefix(&self, prefix: &[u8]) -> Result<RangeProof, Error>
Build a complete proof for all entries under prefix.
Sourcepub fn prove_range_page(
&self,
cursor: &RangeCursor,
end: Option<&[u8]>,
limit: usize,
) -> Result<ProvedRangePage, Error>
pub fn prove_range_page( &self, cursor: &RangeCursor, end: Option<&[u8]>, limit: usize, ) -> Result<ProvedRangePage, Error>
Read and prove one cursor page.
Sourcepub fn authenticate_proof_bundle(
&self,
proof_bundle: impl Into<Vec<u8>>,
secret: &[u8],
authentication: ProofAuthentication,
) -> Result<AuthenticatedProofEnvelope, Error>
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.
Sourcepub fn export(&self) -> Result<SnapshotBundle, Error>
pub fn export(&self) -> Result<SnapshotBundle, Error>
Export this tree and every reachable node as a portable verified bundle.
Sourcepub fn plan_missing_nodes<D: Store>(
&self,
destination: &D,
) -> Result<MissingNodePlan, Error>
pub fn plan_missing_nodes<D: Store>( &self, destination: &D, ) -> Result<MissingNodePlan, Error>
Plan which nodes another store is missing for this snapshot.
Sourcepub fn copy_missing_nodes<D: Store>(
&self,
destination: &D,
) -> Result<MissingNodeCopy, Error>
pub fn copy_missing_nodes<D: Store>( &self, destination: &D, ) -> Result<MissingNodeCopy, Error>
Copy this snapshot’s missing nodes into another store.
Sourcepub fn push_to<D>(
&self,
destination: &VersionedMap<'_, D>,
) -> Result<MapVersion, Error>
pub fn push_to<D>( &self, destination: &VersionedMap<'_, D>, ) -> Result<MapVersion, Error>
Copy and publish this snapshot as the head of another managed map.
Sourcepub fn pin_path(&self, key: &[u8]) -> Result<usize, Error>
pub fn pin_path(&self, key: &[u8]) -> Result<usize, Error>
Pin the root-to-leaf path for one hot key or prefix.
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> 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
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>
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>
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