pub struct Snapshot {
pub snapshot_id: u64,
/* private fields */
}Expand description
A point-in-time read-only view over a set of segments.
The snapshot holds a reference to the SnapshotRegistry and automatically
releases its pins when dropped.
Holds cloned SegmentReader instances with cached indexes, so reads
reuse the Engine’s already-opened segment metadata without re-parsing files.
Fields§
§snapshot_id: u64Unique ID assigned by SnapshotRegistry::register.
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn new(
snapshot_id: u64,
registry: SnapshotRegistry,
readers: Vec<SegmentReader>,
) -> Self
pub fn new( snapshot_id: u64, registry: SnapshotRegistry, readers: Vec<SegmentReader>, ) -> Self
Create a new Snapshot. Called by Engine::snapshot().
Sourcepub fn get(
&self,
ns: &[u8],
key: &[u8],
) -> Result<Option<Vec<u8>>, EdgestoreError>
pub fn get( &self, ns: &[u8], key: &[u8], ) -> Result<Option<Vec<u8>>, EdgestoreError>
Look up a single key in the snapshot.
Reads from all pinned segments and returns the value from the entry with
the highest LSN. Returns Ok(None) if not found or if the latest entry
is a Delete.
Sourcepub fn range(
&self,
ns: &[u8],
start: &[u8],
end: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, EdgestoreError>
pub fn range( &self, ns: &[u8], start: &[u8], end: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, EdgestoreError>
Iterate over key-value pairs in [start, end) within a namespace.
Reads from all pinned segments, merges using LWW (last write wins by LSN),
and returns a sorted vec of (raw_key, value) pairs with deletes filtered out.