pub struct SnapshotManager { /* private fields */ }Expand description
Snapshot manager for saving and restoring system states
Manages snapshots stored in a directory structure:
~/.mockforge/snapshots/{workspace_id}/{snapshot_name}/
Implementations§
Source§impl SnapshotManager
impl SnapshotManager
Sourcepub fn new(base_dir: Option<PathBuf>) -> Self
pub fn new(base_dir: Option<PathBuf>) -> Self
Create a new snapshot manager
Defaults to ~/.mockforge/snapshots if no base directory is provided.
Sourcepub async fn save_snapshot(
&self,
name: String,
description: Option<String>,
workspace_id: String,
components: SnapshotComponents,
consistency_engine: Option<&ConsistencyEngine>,
workspace_persistence: Option<&WorkspacePersistence>,
vbr_state: Option<Value>,
recorder_state: Option<Value>,
) -> Result<SnapshotManifest>
pub async fn save_snapshot( &self, name: String, description: Option<String>, workspace_id: String, components: SnapshotComponents, consistency_engine: Option<&ConsistencyEngine>, workspace_persistence: Option<&WorkspacePersistence>, vbr_state: Option<Value>, recorder_state: Option<Value>, ) -> Result<SnapshotManifest>
Save a snapshot of the current system state
This creates a snapshot directory and saves all specified components.
§Arguments
name- Name for the snapshotdescription- Optional descriptionworkspace_id- Workspace identifiercomponents- Which components to includeconsistency_engine- Optional consistency engine for unified stateworkspace_persistence- Optional workspace persistence for configvbr_state- Optional VBR state (pre-extracted JSON)recorder_state- Optional Recorder state (pre-extracted JSON)
Sourcepub async fn save_snapshot_with_exporters(
&self,
name: String,
description: Option<String>,
workspace_id: String,
components: SnapshotComponents,
consistency_engine: Option<&ConsistencyEngine>,
workspace_persistence: Option<&WorkspacePersistence>,
vbr_state: Option<Value>,
recorder_state: Option<Value>,
protocol_exporters: HashMap<String, Arc<dyn ProtocolStateExporter>>,
) -> Result<SnapshotManifest>
pub async fn save_snapshot_with_exporters( &self, name: String, description: Option<String>, workspace_id: String, components: SnapshotComponents, consistency_engine: Option<&ConsistencyEngine>, workspace_persistence: Option<&WorkspacePersistence>, vbr_state: Option<Value>, recorder_state: Option<Value>, protocol_exporters: HashMap<String, Arc<dyn ProtocolStateExporter>>, ) -> Result<SnapshotManifest>
Save a snapshot with protocol state exporters
Extended version that accepts a map of protocol state exporters for capturing state from multiple protocols.
Sourcepub async fn load_snapshot(
&self,
name: String,
workspace_id: String,
components: Option<SnapshotComponents>,
consistency_engine: Option<&ConsistencyEngine>,
workspace_persistence: Option<&WorkspacePersistence>,
) -> Result<(SnapshotManifest, Option<Value>, Option<Value>)>
pub async fn load_snapshot( &self, name: String, workspace_id: String, components: Option<SnapshotComponents>, consistency_engine: Option<&ConsistencyEngine>, workspace_persistence: Option<&WorkspacePersistence>, ) -> Result<(SnapshotManifest, Option<Value>, Option<Value>)>
Load a snapshot and restore system state
Restores the specified components from a snapshot. Returns the manifest and optionally the VBR and Recorder state as JSON (caller is responsible for restoring them to their respective systems).
Sourcepub async fn load_snapshot_with_exporters(
&self,
name: String,
workspace_id: String,
components: Option<SnapshotComponents>,
consistency_engine: Option<&ConsistencyEngine>,
workspace_persistence: Option<&WorkspacePersistence>,
protocol_exporters: HashMap<String, Arc<dyn ProtocolStateExporter>>,
) -> Result<(SnapshotManifest, Option<Value>, Option<Value>)>
pub async fn load_snapshot_with_exporters( &self, name: String, workspace_id: String, components: Option<SnapshotComponents>, consistency_engine: Option<&ConsistencyEngine>, workspace_persistence: Option<&WorkspacePersistence>, protocol_exporters: HashMap<String, Arc<dyn ProtocolStateExporter>>, ) -> Result<(SnapshotManifest, Option<Value>, Option<Value>)>
Load a snapshot and restore system state with protocol exporters
Extended version that accepts protocol state exporters to restore protocol-specific state from snapshots.
§Arguments
name- Snapshot nameworkspace_id- Workspace identifiercomponents- Which components to restore (uses manifest if None)consistency_engine- Optional consistency engine for unified stateworkspace_persistence- Optional workspace persistence for configprotocol_exporters- Map of protocol exporters for restoring protocol state
Sourcepub async fn list_snapshots(
&self,
workspace_id: &str,
) -> Result<Vec<SnapshotMetadata>>
pub async fn list_snapshots( &self, workspace_id: &str, ) -> Result<Vec<SnapshotMetadata>>
List all snapshots for a workspace
Sourcepub async fn delete_snapshot(
&self,
name: String,
workspace_id: String,
) -> Result<()>
pub async fn delete_snapshot( &self, name: String, workspace_id: String, ) -> Result<()>
Delete a snapshot
Sourcepub async fn get_snapshot_info(
&self,
name: String,
workspace_id: String,
) -> Result<SnapshotManifest>
pub async fn get_snapshot_info( &self, name: String, workspace_id: String, ) -> Result<SnapshotManifest>
Get snapshot information
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SnapshotManager
impl RefUnwindSafe for SnapshotManager
impl Send for SnapshotManager
impl Sync for SnapshotManager
impl Unpin for SnapshotManager
impl UnwindSafe for SnapshotManager
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
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