Skip to main content

Snapshot

Struct Snapshot 

Source
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: u64

Unique ID assigned by SnapshotRegistry::register.

Implementations§

Source§

impl Snapshot

Source

pub fn new( snapshot_id: u64, registry: SnapshotRegistry, readers: Vec<SegmentReader>, ) -> Self

Create a new Snapshot. Called by Engine::snapshot().

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for Snapshot

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V