pub struct SnapshotStore { /* private fields */ }Expand description
Persistent store for VM snapshots.
Implementations§
Source§impl SnapshotStore
impl SnapshotStore
Sourcepub fn new(base_dir: &Path) -> Result<Self>
pub fn new(base_dir: &Path) -> Result<Self>
Create a new snapshot store at the given directory.
Sourcepub fn default_path() -> Result<Self>
pub fn default_path() -> Result<Self>
Open the default snapshot store at ~/.a3s/snapshots.
Sourcepub fn save(
&self,
metadata: SnapshotMetadata,
rootfs_source: &Path,
) -> Result<SnapshotMetadata>
pub fn save( &self, metadata: SnapshotMetadata, rootfs_source: &Path, ) -> Result<SnapshotMetadata>
Save a snapshot with the given metadata and rootfs source.
Copies the rootfs directory into the snapshot bundle.
Returns the updated metadata with size_bytes populated.
Sourcepub fn rootfs_path(&self, id: &str) -> PathBuf
pub fn rootfs_path(&self, id: &str) -> PathBuf
Get the rootfs path for a snapshot.
Sourcepub fn list(&self) -> Result<Vec<SnapshotMetadata>>
pub fn list(&self) -> Result<Vec<SnapshotMetadata>>
List all snapshots, sorted by creation time (newest first).
Sourcepub fn total_size(&self) -> Result<u64>
pub fn total_size(&self) -> Result<u64>
Calculate total size of all snapshots in bytes.
Trait Implementations§
Source§impl SnapshotStoreBackend for SnapshotStore
impl SnapshotStoreBackend for SnapshotStore
Source§fn save(
&self,
metadata: SnapshotMetadata,
rootfs_source: &Path,
) -> Result<SnapshotMetadata>
fn save( &self, metadata: SnapshotMetadata, rootfs_source: &Path, ) -> Result<SnapshotMetadata>
Save a snapshot with its rootfs source directory. Read more
Source§fn get(&self, id: &str) -> Result<Option<SnapshotMetadata>>
fn get(&self, id: &str) -> Result<Option<SnapshotMetadata>>
Load snapshot metadata by ID. Returns
None if not found.Source§fn list(&self) -> Result<Vec<SnapshotMetadata>>
fn list(&self) -> Result<Vec<SnapshotMetadata>>
List all snapshots, sorted by creation time (newest first).
Source§fn delete(&self, id: &str) -> Result<bool>
fn delete(&self, id: &str) -> Result<bool>
Delete a snapshot by ID. Returns
true if it existed.Source§fn total_size(&self) -> Result<u64>
fn total_size(&self) -> Result<u64>
Total disk usage in bytes across all snapshots.
Auto 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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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