SqliteBaseStore
public class SqliteBaseStore implements BaseStore, AutoCloseable
io/agentscope/harness/coding/store/SqliteBaseStore.java:51–248Sqlite 基类存储,负责持久化与读取数据。位于 io.agentscope.harness.coding.store 包,实现 BaseStore、AutoCloseable。核心成员包括 get、put、putIfVersion、search、delete、count。
SQLite-backed implementation of BaseStore.
All items are stored in a single table with columns: namespace (text), key
(text), value (JSON text), version (integer, monotonically increasing). The
combination of namespace + key is the primary key.
Namespace lists are serialized as /-joined strings (e.g. ["threads", "abc"]
→ "threads/abc").
Used as the unified backend for:
-
["threads", thread_id]— thread metadata -
["queue", thread_id]— message queue -
["deliveries"]— webhook delivery dedup -
["findings", thread_id]— reviewer findings
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public SqliteBaseStore(String dbPath) throws SQLException | 初始化 `SqliteBaseStore` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public StoreItem get(List<String> namespace, String key) | 按条件读取数据。 Performs the get operation. |
public void put(List<String> namespace, String key, Map<String, Object> value) | 执行 `put` 方法。 Performs the put operation. |
public boolean putIfVersion(List<String> namespace, String key, Map<String, Object> value, long expectedVersion) | 执行 `putIfVersion` 方法。 Atomic compare-and-swap backed by SQLite. |
public List<StoreItem> search(List<String> namespace, int limit, int offset) | 执行搜索相关操作。 Performs the search operation. |
public void delete(List<String> namespace, String key) | 删除数据。 Performs the delete operation. |
public int count(List<String> namespace) | 设置数量。 Counts items in a namespace. |
public void close() throws SQLException | 关闭连接并释放相关资源。 Releases resources and connections. |
构造器详情Constructor Detail
SqliteBaseStore
public SqliteBaseStore(String dbPath) throws SQLException
初始化 SqliteBaseStore 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
dbPath | String | 数据库路径(类型 `String`)。The db path. |
SQLException可能抛出 `SQLException`。Thrown when the operation cannot be completed.
io/agentscope/harness/coding/store/SqliteBaseStore.java:58–62方法详情Method Detail
get
public StoreItem get(List<String> namespace, String key)
按条件读取数据。
Performs the get operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。The namespace. |
key | String | 键(类型 `String`)。The key. |
StoreItemio/agentscope/harness/coding/store/SqliteBaseStore.java:98–116put
public void put(List<String> namespace, String key, Map<String, Object> value)
执行 put 方法。
Performs the put operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。The namespace. |
key | String | 键(类型 `String`)。The key. |
value | Map<String, Object> | 值(类型 `Map`)。The value. |
io/agentscope/harness/coding/store/SqliteBaseStore.java:118–140putIfVersion
public boolean putIfVersion(List<String> namespace, String key, Map<String, Object> value, long expectedVersion)
执行 putIfVersion 方法。
Atomic compare-and-swap backed by SQLite.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。The namespace. |
key | String | 键(类型 `String`)。The key. |
value | Map<String, Object> | 值(类型 `Map`)。The value. |
expectedVersion | long | expected 版本(类型 `long`)。The expected version. |
booleanio/agentscope/harness/coding/store/SqliteBaseStore.java:150–182search
public List<StoreItem> search(List<String> namespace, int limit, int offset)
执行搜索相关操作。
Performs the search operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。The namespace. |
limit | int | 数量上限(类型 `int`)。The limit. |
offset | int | 偏移量(类型 `int`)。The offset. |
List<StoreItem>io/agentscope/harness/coding/store/SqliteBaseStore.java:184–208delete
public void delete(List<String> namespace, String key)
删除数据。
Performs the delete operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。The namespace. |
key | String | 键(类型 `String`)。The key. |
io/agentscope/harness/coding/store/SqliteBaseStore.java:210–221count
public int count(List<String> namespace)
设置数量。
Counts items in a namespace.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespace | List<String> | 命名空间(类型 `List`)。The namespace. |
intio/agentscope/harness/coding/store/SqliteBaseStore.java:224–235close
public void close() throws SQLException
关闭连接并释放相关资源。
Releases resources and connections.
SQLException可能抛出 `SQLException`。Thrown when the operation cannot be completed.
io/agentscope/harness/coding/store/SqliteBaseStore.java:237–242