Class NoopSandboxSnapshot

java.lang.Object
io.agentscope.harness.agent.sandbox.snapshot.NoopSandboxSnapshot
All Implemented Interfaces:
SandboxSnapshot

public class NoopSandboxSnapshot extends Object implements 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 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 to true.

      Returns false — workspace archiving is skipped entirely when this snapshot is in use, so this method is never called in normal operation.

      Specified by:
      isPersistenceEnabled in interface SandboxSnapshot
      Returns:
      false only for no-op implementations that discard all archive data
    • persist

      public void persist(InputStream workspaceArchive) throws Exception
      Persists the workspace archive to this snapshot.

      This implementation discards the archive stream entirely.

      Specified by:
      persist in interface SandboxSnapshot
      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

      public InputStream restore() throws Exception
      Restores the workspace archive from this snapshot.

      Always throws SandboxException.SnapshotException since noop snapshots are never restorable.

      Specified by:
      restore in interface SandboxSnapshot
      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:
      isRestorable in interface SandboxSnapshot
      Returns:
      always false
    • getId

      public String getId()
      Description copied from interface: SandboxSnapshot
      Returns the unique identifier for this snapshot.
      Specified by:
      getId in interface SandboxSnapshot
      Returns:
      snapshot id
    • getType

      public String getType()
      Description copied from interface: SandboxSnapshot
      Returns the snapshot type discriminator used in JSON serialization.
      Specified by:
      getType in interface SandboxSnapshot
      Returns:
      type string (e.g. "noop", "local", "remote")