Class NoopSandboxSnapshot
java.lang.Object
io.agentscope.harness.agent.sandbox.snapshot.NoopSandboxSnapshot
- All Implemented Interfaces:
SandboxSnapshot
No-op snapshot that does not persist anything.
When using NoopSandboxSnapshot, workspace state is NOT preserved between
session stops. Each time a session is started fresh, the full manifest is applied
(Branch D of the start logic). Use this when workspace durability is not required.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()Returns the unique identifier for this snapshot.getType()Returns the snapshot type discriminator used in JSON serialization.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.
-
Constructor Details
-
NoopSandboxSnapshot
public NoopSandboxSnapshot()Creates a noop snapshot.
-
-
Method Details
-
isPersistenceEnabled
public 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— workspace archiving is skipped entirely when this snapshot is in use, so this method is never called in normal operation.- Specified by:
isPersistenceEnabledin interfaceSandboxSnapshot- Returns:
- false only for no-op implementations that discard all archive data
-
persist
Persists the workspace archive to this snapshot.This implementation discards the archive stream entirely.
- Specified by:
persistin interfaceSandboxSnapshot- 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.Always throws
SandboxException.SnapshotExceptionsince noop snapshots are never restorable.- Specified by:
restorein interfaceSandboxSnapshot- 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
public boolean isRestorable()Returns whether this snapshot can currently be restored.- Specified by:
isRestorablein interfaceSandboxSnapshot- Returns:
- always
false
-
getId
Description copied from interface:SandboxSnapshotReturns the unique identifier for this snapshot.- Specified by:
getIdin interfaceSandboxSnapshot- Returns:
- snapshot id
-
getType
Description copied from interface:SandboxSnapshotReturns the snapshot type discriminator used in JSON serialization.- Specified by:
getTypein interfaceSandboxSnapshot- Returns:
- type string (e.g. "noop", "local", "remote")
-