pub struct SnapshotStore { /* private fields */ }Expand description
Content-addressed snapshot store
Implementations§
Source§impl SnapshotStore
impl SnapshotStore
pub fn new(root: impl Into<PathBuf>) -> Result<Self>
pub fn put_blob(&self, data: &[u8]) -> Result<HashDigest>
pub fn get_blob(&self, hash: &HashDigest) -> Result<Vec<u8>>
pub fn put_struct<T: Serialize>(&self, value: &T) -> Result<HashDigest>
pub fn get_struct<T: for<'de> Deserialize<'de>>( &self, hash: &HashDigest, ) -> Result<T>
pub fn put_snapshot(&self, snapshot: &ExecutionSnapshot) -> Result<HashDigest>
pub fn get_snapshot(&self, hash: &HashDigest) -> Result<ExecutionSnapshot>
Sourcepub fn list_snapshots(&self) -> Result<Vec<(HashDigest, ExecutionSnapshot)>>
pub fn list_snapshots(&self) -> Result<Vec<(HashDigest, ExecutionSnapshot)>>
List all snapshots in the store, returning (hash, snapshot) pairs.
Note: This method eagerly loads and deserializes every snapshot in the
store directory into memory. For stores with many snapshots this may
become a bottleneck. A future improvement could return a lazy iterator
that streams snapshot metadata (hash + created_at_ms) without
deserializing full payloads until requested — e.g. via a
SnapshotEntry { hash, created_at_ms } header read, deferring full
ExecutionSnapshot deserialization to an explicit .load() call.
Sourcepub fn delete_snapshot(&self, hash: &HashDigest) -> Result<()>
pub fn delete_snapshot(&self, hash: &HashDigest) -> Result<()>
Delete a snapshot file by hash.
Trait Implementations§
Source§impl Clone for SnapshotStore
impl Clone for SnapshotStore
Source§fn clone(&self) -> SnapshotStore
fn clone(&self) -> SnapshotStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SnapshotStore
impl RefUnwindSafe for SnapshotStore
impl Send for SnapshotStore
impl Sync for SnapshotStore
impl Unpin for SnapshotStore
impl UnsafeUnpin for SnapshotStore
impl UnwindSafe for SnapshotStore
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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