Class RemoteSandboxSnapshot
java.lang.Object
io.agentscope.harness.agent.sandbox.snapshot.RemoteSandboxSnapshot
- All Implemented Interfaces:
SandboxSnapshot
Snapshot backed by a
RemoteSnapshotClient (e.g. S3, OSS, GCS).
This class delegates all operations to the provided client. The client is responsible for authentication, retry logic, and network error handling.
Note: RemoteSandboxSnapshot is not directly serializable to JSON because
RemoteSnapshotClient cannot be serialized. When persisting session state,
only the id is needed — the client is re-injected from the builder at resume time.
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteSandboxSnapshot(RemoteSnapshotClient client, String id) Creates a remote snapshot. -
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 can currently be restored.voidpersist(InputStream workspaceArchive) Persists the workspace archive to this snapshot.restore()Restores the workspace archive from this snapshot.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.agentscope.harness.agent.sandbox.snapshot.SandboxSnapshot
isPersistenceEnabled
-
Constructor Details
-
RemoteSandboxSnapshot
-
RemoteSandboxSnapshot
Creates a remote snapshot.- Parameters:
client- the remote storage client to delegate operations toid- unique identifier for this snapshot
-
-
Method Details
-
persist
Persists the workspace archive to this snapshot.Uploads the archive via
RemoteSnapshotClient.upload(java.lang.String, java.io.InputStream).- 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.Downloads the archive via
RemoteSnapshotClient.download(java.lang.String).- 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
Returns whether this snapshot can currently be restored.Checks existence via
RemoteSnapshotClient.exists(java.lang.String).- Specified by:
isRestorablein interfaceSandboxSnapshot- Returns:
- true if
SandboxSnapshot.restore()would succeed - Throws:
Exception- if checking restorability fails
-
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")
-