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 (const: unstable) · 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