ControlPlaneTaskRepository
public final class ControlPlaneTaskRepository implements TaskRepository
io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:62–852控制面任务仓库,负责持久化与读取数据。位于 io.agentscope.extensions.controlplane.store 包,实现 TaskRepository。核心成员包括 setCompletionCallback、putTask、getTask、listTasks、cancelTask、findPendingDeliveries。
Control-plane hosted TaskRepository over /api/v1/dp/tasks/*.
Maintains in-memory BackgroundTask handles for tasks running on the current node while
using the control plane as the authoritative persistence layer. Heartbeats live local tasks every
{@value #HEARTBEAT_INTERVAL_SECONDS} seconds via POST /tasks/heartbeat; there is no
client-side orphan sweeper.
方法摘要Method Summary
方法详情Method Detail
setCompletionCallback
public void setCompletionCallback(TaskCompletionCallback callback)
设置补全回调。
Sets the completion callback.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
callback | TaskCompletionCallback | 回调函数(类型 `TaskCompletionCallback`)。The callback. |
io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:165–168putTask
public BackgroundTask putTask(RuntimeContext rc, String taskId, String subAgentId, String sessionId, TaskRunSpec spec)
执行 putTask 方法。
Performs the put task operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
taskId | String | 任务标识(类型 `String`)。The task id. |
subAgentId | String | 子智能体标识(类型 `String`)。The sub agent id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
spec | TaskRunSpec | 规格(类型 `TaskRunSpec`)。The spec. |
BackgroundTaskio/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:170–250getTask
public BackgroundTask getTask(RuntimeContext rc, String sessionId, String taskId)
获取任务。
Returns the task.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
taskId | String | 任务标识(类型 `String`)。The task id. |
BackgroundTaskio/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:252–260listTasks
public Collection<BackgroundTask> listTasks(RuntimeContext rc, String sessionId, TaskStatus filter)
列出任务。
Lists the tasks.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
filter | TaskStatus | 过滤条件(类型 `TaskStatus`)。The filter. |
Collection<BackgroundTask>io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:262–283cancelTask
public boolean cancelTask(RuntimeContext rc, String sessionId, String taskId)
执行取消任务相关操作。
Performs the cancel task operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
taskId | String | 任务标识(类型 `String`)。The task id. |
booleanio/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:285–324findPendingDeliveries
public List<TaskDelivery> findPendingDeliveries(RuntimeContext rc, String sessionId)
查找 findPendingDeliveries。
Finds the pending deliveries.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
List<TaskDelivery>io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:326–365markDelivered
public void markDelivered(RuntimeContext rc, String sessionId, String taskId)
执行 markDelivered 方法。
Performs the mark delivered operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
taskId | String | 任务标识(类型 `String`)。The task id. |
io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:367–385isDelivered
public boolean isDelivered(RuntimeContext rc, String sessionId, String taskId)
判断是否 isDelivered。
Returns whether the delivered.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
taskId | String | 任务标识(类型 `String`)。The task id. |
booleanio/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:387–391shutdown
public void shutdown()
关闭资源并释放连接。
Releases resources and connections.
io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:393–417