Class MongoRemoteSnapshotClient
java.lang.Object
io.agentscope.extensions.mongodb.snapshot.MongoRemoteSnapshotClient
- All Implemented Interfaces:
io.agentscope.harness.agent.sandbox.snapshot.RemoteSnapshotClient
public class MongoRemoteSnapshotClient
extends Object
implements io.agentscope.harness.agent.sandbox.snapshot.RemoteSnapshotClient
RemoteSnapshotClient backed by MongoDB GridFS.
Stores sandbox workspace tar archives in GridFS, which transparently chunks data into 255 KB segments and supports files up to 16 GB — removing the 16 MB BSON document limit that constrains single-document Binary storage.
Snapshots have no independent TTL — aligned with Postgres/JDBC/Redis which retain
snapshots indefinitely. A snapshot is reclaimed only by delete(String) when the
owning session is explicitly deleted (cascade cleanup driven by
MongoDistributedStore).
For backward compatibility, download(java.lang.String) and exists(java.lang.String) fall back to reading
from the legacy single-document collection if the file is not found in GridFS.
-
Constructor Summary
ConstructorsConstructorDescriptionMongoRemoteSnapshotClient(com.mongodb.client.MongoClient mongoClient, String databaseName, String collectionName) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeletes a snapshot from GridFS.booleanvoidupload(String snapshotId, InputStream data)
-
Constructor Details
-
MongoRemoteSnapshotClient
-
-
Method Details
-
upload
- Specified by:
uploadin interfaceio.agentscope.harness.agent.sandbox.snapshot.RemoteSnapshotClient- Throws:
Exception
-
download
- Specified by:
downloadin interfaceio.agentscope.harness.agent.sandbox.snapshot.RemoteSnapshotClient- Throws:
Exception
-
exists
- Specified by:
existsin interfaceio.agentscope.harness.agent.sandbox.snapshot.RemoteSnapshotClient- Throws:
Exception
-
delete
Deletes a snapshot from GridFS.- Parameters:
snapshotId- the snapshot identifier (stored as GridFS filename)- Returns:
trueif a file was deleted,falseif no matching snapshot existed- Throws:
Exception- if a MongoDB error occurs
-