Skip to main content

WorkspaceStoreAdapter

Trait WorkspaceStoreAdapter 

Source
pub trait WorkspaceStoreAdapter: Send + Sync {
    // Required methods
    fn load(&self, workspace_root: &Path) -> Result<Workspace, StoreError>;
    fn save_state(
        &self,
        workspace_root: &Path,
        workspace: &Workspace,
    ) -> Result<(), StoreError>;
}
Expand description

Adapter trait — the seam between the engine and the persisted workspace state. Implementations decide where the mount list lives (two files under .memstead/, a SQLite database, a remote service, an in-memory test fixture); the engine consumes the produced Workspace uniformly.

Required Methods§

Source

fn load(&self, workspace_root: &Path) -> Result<Workspace, StoreError>

Load the workspace from workspace_root. Implementations resolve the adapter-specific files relative to this root (e.g. the file adapter reads <workspace_root>/.memstead/workspace.toml + <workspace_root>/.memstead/state/mounts.json).

Source

fn save_state( &self, workspace_root: &Path, workspace: &Workspace, ) -> Result<(), StoreError>

Persist the engine-managed slice of state (today: the mount list). Operator-edited fields stay untouched — adapters that share one file with operator content must not overwrite it here. The two-layer file adapter writes only state/mounts.json.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§