pub struct SnapshotStore { /* private fields */ }Expand description
Persistent store for VM snapshots.
Implementations§
Source§impl SnapshotStore
impl SnapshotStore
Sourcepub fn rootfs_format(&self, id: &str) -> Result<SnapshotRootfsFormat>
pub fn rootfs_format(&self, id: &str) -> Result<SnapshotRootfsFormat>
Inspect and validate the rootfs representation of a published snapshot.
Sourcepub fn restore_rootfs_to_box(
&self,
id: &str,
box_dir: &Path,
) -> Result<RestoredSnapshotRootfs>
pub fn restore_rootfs_to_box( &self, id: &str, box_dir: &Path, ) -> Result<RestoredSnapshotRootfs>
Materialize a published snapshot into a newly-created box directory.
Directory payloads publish the historical .snapshot-lower reference
while the store lock is held. Raw payloads clone and validate a private
writable artifact, so deleting the snapshot later cannot affect the box.
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 delete_force(&self, id: &str) -> Result<bool>
pub fn delete_force(&self, id: &str) -> Result<bool>
Delete a snapshot even when a restored directory-backed box still
references it. This deliberately unsafe operation exists only for the
CLI’s explicit snapshot rm --force contract.
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>
Source§fn get(&self, id: &str) -> Result<Option<SnapshotMetadata>>
fn get(&self, id: &str) -> Result<Option<SnapshotMetadata>>
None if not found.Source§fn list(&self) -> Result<Vec<SnapshotMetadata>>
fn list(&self) -> Result<Vec<SnapshotMetadata>>
Source§fn delete(&self, id: &str) -> Result<bool>
fn delete(&self, id: &str) -> Result<bool>
true if it existed.Source§fn total_size(&self) -> Result<u64>
fn total_size(&self) -> Result<u64>
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
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> ⓘ
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> ⓘ
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