AS AgentScopeAPI 手册 / API Reference

SqliteBaseStore

public class SqliteBaseStore implements BaseStore, AutoCloseable
源码Source io/agentscope/harness/coding/store/SqliteBaseStore.java:51–248

Sqlite 基类存储,负责持久化与读取数据。位于 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.

参数Parameters
名称Name类型Type说明Description
dbPathString数据库路径(类型 `String`)。The db path.
抛出Throws
  • SQLException 可能抛出 `SQLException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/coding/store/SqliteBaseStore.java:58–62

方法详情Method Detail

get

public StoreItem get(List<String> namespace, String key)

按条件读取数据。

Performs the get operation.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
keyString键(类型 `String`)。The key.
返回Returns StoreItem
返回StoreItem。Returns store item.
源码Source io/agentscope/harness/coding/store/SqliteBaseStore.java:98–116

put

public void put(List<String> namespace, String key, Map<String, Object> value)

执行 put 方法。

Performs the put operation.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
keyString键(类型 `String`)。The key.
valueMap<String, Object>值(类型 `Map`)。The value.
源码Source io/agentscope/harness/coding/store/SqliteBaseStore.java:118–140

putIfVersion

public boolean putIfVersion(List<String> namespace, String key, Map<String, Object> value, long expectedVersion)

执行 putIfVersion 方法。

Atomic compare-and-swap backed by SQLite.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
keyString键(类型 `String`)。The key.
valueMap<String, Object>值(类型 `Map`)。The value.
expectedVersionlongexpected 版本(类型 `long`)。The expected version.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/coding/store/SqliteBaseStore.java:150–182

delete

public void delete(List<String> namespace, String key)

删除数据。

Performs the delete operation.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
keyString键(类型 `String`)。The key.
源码Source io/agentscope/harness/coding/store/SqliteBaseStore.java:210–221

count

public int count(List<String> namespace)

设置数量。

Counts items in a namespace.

参数Parameters
名称Name类型Type说明Description
namespaceList<String>命名空间(类型 `List`)。The namespace.
返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/harness/coding/store/SqliteBaseStore.java:224–235

close

public void close() throws SQLException

关闭连接并释放相关资源。

Releases resources and connections.

抛出Throws
  • SQLException 可能抛出 `SQLException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/coding/store/SqliteBaseStore.java:237–242
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.