MysqlDistributedStore
@Deprecated(since = "2.1", forRemoval = true) public class MysqlDistributedStore implements DistributedStore
源码Source
io/agentscope/extensions/mysql/MysqlDistributedStore.java:60–98MySQL 分布式存储,负责持久化与读取数据。位于 io.agentscope.extensions.mysql 包,实现 DistributedStore。核心成员包括 create、agentStateStore、baseStore、sandboxSnapshotSpec、sandboxExecutionGuard。
MySQL/JDBC-backed DistributedStore.
Usage:
`DataSource dataSource = ... // HikariCP, Druid, etc.
HarnessAgent agent = HarnessAgent.builder()
.name("my-agent")
.model("dashscope:qwen-plus")
.distributedStore(MysqlDistributedStore.create(dataSource))
.filesystem(new DockerFilesystemSpec()
.image("ubuntu:24.04"))
.build();
`
This configures:
-
MysqlAgentStateStore— agent session state in MySQL -
JdbcStore— workspace filesystem KV in MySQL -
JdbcSnapshotSpec— sandbox snapshots as BLOBs in MySQL -
JdbcSandboxExecutionGuard— distributed lock via MySQLGET_LOCK()
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static MysqlDistributedStore create(DataSource dataSource)static | 创建MySQL 分布式存储。 Creates a MySQL distributed store. |
public AgentStateStore agentStateStore() | 返回智能体状态存储。 Returns the agent state store. |
public BaseStore baseStore() | 返回基类存储。 Returns the base store. |
public SandboxSnapshotSpec sandboxSnapshotSpec() | 返回沙箱快照规格。 Returns the sandbox snapshot spec. |
public SandboxExecutionGuard sandboxExecutionGuard() | 返回沙箱执行守卫。 Returns the sandbox execution guard. |
方法详情Method Detail
create
public static MysqlDistributedStore create(DataSource dataSource)
static
创建MySQL 分布式存储。
Creates a MySQL distributed store.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
dataSource | DataSource | 用于MySQL的JDBC 数据来源。JDBC data source for MySQL |
MysqlDistributedStore一种新的MySQL 分布式存储。a new MySQL distributed store
源码Source
io/agentscope/extensions/mysql/MysqlDistributedStore.java:75–77agentStateStore
public AgentStateStore agentStateStore()
返回智能体状态存储。
Returns the agent state store.
AgentStateStore返回AgentStateStore。Returns agent state store.
源码Source
io/agentscope/extensions/mysql/MysqlDistributedStore.java:79–82baseStore
public BaseStore baseStore()
返回基类存储。
Returns the base store.
BaseStore返回BaseStore。Returns base store.
源码Source
io/agentscope/extensions/mysql/MysqlDistributedStore.java:84–87sandboxSnapshotSpec
public SandboxSnapshotSpec sandboxSnapshotSpec()
返回沙箱快照规格。
Returns the sandbox snapshot spec.
SandboxSnapshotSpec返回SandboxSnapshotSpec。Returns sandbox snapshot spec.
源码Source
io/agentscope/extensions/mysql/MysqlDistributedStore.java:89–92sandboxExecutionGuard
public SandboxExecutionGuard sandboxExecutionGuard()
返回沙箱执行守卫。
Returns the sandbox execution guard.
SandboxExecutionGuard返回SandboxExecutionGuard。Returns sandbox execution guard.
源码Source
io/agentscope/extensions/mysql/MysqlDistributedStore.java:94–97