BaseStore
public interface BaseStore
源码Source
io/agentscope/harness/agent/filesystem/remote/store/BaseStore.java:27–96定义基类存储契约的接口。位于 io.agentscope.harness.agent.filesystem.remote.store 包。核心成员包括 get、put、putIfVersion、search、delete。
Abstract interface for a namespace-based key-value store.
Items are organized by namespaces (hierarchical path-like tuples) and identified by a key within each namespace.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public StoreItem get(List<String> namespace, String key) | 按条件读取数据。 Get a single item by namespace and key. |
public void put(List<String> namespace, String key, Map<String, Object> value) | 执行 `put` 方法。 Store or update an item. |
default public boolean putIfVersion(List<String> namespace, String key, Map<String, Object> value, long expectedVersion)default | 执行 `putIfVersion` 方法。 Conditional update: stores the item only when the current stored version matches
`expectedVersion`. |
public List<StoreItem> search(List<String> namespace, int limit, int offset) | 执行搜索相关操作。 Search for items within a namespace with pagination. |
public void delete(List<String> namespace, String key) | 删除数据。 Delete an item by namespace and key. |
方法详情Method Detail
get
public StoreItem get(List<String> namespace, String key)
按条件读取数据。
Get a single item by namespace and key.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。hierarchical namespace path |
key | String | 键(类型 `String`)。the item key within the namespace |
StoreItem存储条目,或`null`if 不找到。the store item, or `null` if not found
源码Source
io/agentscope/harness/agent/filesystem/remote/store/BaseStore.java:36put
public void put(List<String> namespace, String key, Map<String, Object> value)
执行 put 方法。
Store or update an item.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。hierarchical namespace path |
key | String | 键(类型 `String`)。the item key within the namespace |
value | Map<String, Object> | 数据到存储。the data to store |
源码Source
io/agentscope/harness/agent/filesystem/remote/store/BaseStore.java:45putIfVersion
default public boolean putIfVersion(List<String> namespace, String key, Map<String, Object> value, long expectedVersion)
default
执行 putIfVersion 方法。
Conditional update: stores the item only when the current stored version matches expectedVersion.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。hierarchical namespace path |
key | String | 键(类型 `String`)。the item key within the namespace |
value | Map<String, Object> | 新的数据到存储。the new data to store |
expectedVersion | long | expected 版本(类型 `long`)。the version the caller observed; must match the current stored version |
boolean返回布尔值,表示判断结果。`true` if the item was written, `false` if the version did not match
源码Source
io/agentscope/harness/agent/filesystem/remote/store/BaseStore.java:74–77search
public List<StoreItem> search(List<String> namespace, int limit, int offset)
执行搜索相关操作。
Search for items within a namespace with pagination.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。hierarchical namespace path |
limit | int | 数量上限(类型 `int`)。maximum number of items to return |
offset | int | 偏移量(类型 `int`)。number of items to skip |
List<StoreItem>返回列出。list of matching store items
源码Source
io/agentscope/harness/agent/filesystem/remote/store/BaseStore.java:87delete
public void delete(List<String> namespace, String key)
删除数据。
Delete an item by namespace and key.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。hierarchical namespace path |
key | String | 条目密钥到删除。the item key to delete |
源码Source
io/agentscope/harness/agent/filesystem/remote/store/BaseStore.java:95