Interface SandboxSnapshot
- All Known Implementing Classes:
LocalSandboxSnapshot,NoopSandboxSnapshot,RemoteSandboxSnapshot
public interface SandboxSnapshot
Represents a persisted snapshot of a sandbox workspace.
Snapshots allow workspace state to be preserved between session stops and restored on
subsequent session starts. Implementations determine where and how the snapshot is stored:
local disk (LocalSandboxSnapshot), remote storage (RemoteSandboxSnapshot),
or not at all (NoopSandboxSnapshot).
-
Method Summary
Modifier and TypeMethodDescriptiongetId()Returns the unique identifier for this snapshot.getType()Returns the snapshot type discriminator used in JSON serialization.default booleanReturns whether this snapshot actually persists data.booleanReturns whether this snapshot can currently be restored.voidpersist(InputStream workspaceArchive) Persists the workspace archive to this snapshot.restore()Restores the workspace archive from this snapshot.
-
Method Details
-
persist
Persists the workspace archive to this snapshot.- Parameters:
workspaceArchive- tar stream of the workspace to persist; caller is responsible for closing the stream after this call- Throws:
Exception- if the persist operation fails
-
restore
Restores the workspace archive from this snapshot.- Returns:
- tar stream of the workspace; caller is responsible for closing
- Throws:
Exception- if the restore operation fails or the snapshot is not restorable
-
isRestorable
Returns whether this snapshot can currently be restored. -
getId
String getId()Returns the unique identifier for this snapshot.- Returns:
- snapshot id
-
getType
String getType()Returns the snapshot type discriminator used in JSON serialization.- Returns:
- type string (e.g. "noop", "local", "remote")
-
isPersistenceEnabled
default boolean isPersistenceEnabled()Returns whether this snapshot actually persists data.When
false,AbstractBaseSandbox.stop()skips the potentially expensive workspace archive step entirely. Defaults totrue.- Returns:
- false only for no-op implementations that discard all archive data
-