AS AgentScopeAPI 手册 / API Reference

StoreDialect

public interface StoreDialect
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:41–126

定义存储 Dialect契约的接口。位于 io.agentscope.extensions.jdbc.dialect.table 包。核心成员包括 storeTableName、storeCreateTableDdls、storeUpsert、storeInsert、storeCasUpdate、storeSelect。

Table-domain dialect interface for the KV store table.

Defines the create-schema DDL (abstract, varies per database) and ANSI-standard business SQL (default methods returning BoundSql). The aggregate class AbstractJdbcDialect implements this interface along with the other table-domain interfaces; vendor classes extend the aggregate and override only what differs.

Method names are prefixed with store to avoid collision when the aggregate class implements multiple table-domain interfaces.

Secondary index: the namespace_path LIKE 'prefix%' query in #storeSearch requires an index on namespace_path to avoid a full table scan on large stores. Where the database supports it (MySQL), vendors inline INDEX idx_namespace (namespace_path) in the CREATE TABLE statement; the others append an idempotent CREATE INDEX IF NOT EXISTS as a second element of the #storeCreateTableDdls() list.

方法摘要Method Summary

方法Method说明Description
default public String storeTableName()
default
返回 `storeTableName` 结果。
Base table name (without prefix).
public List<String> storeCreateTableDdls()
返回 `storeCreateTableDdls` 结果。
DDL statements (one or more) to create the KV store table.
public BoundSql storeUpsert(String namespacePath, String key, String json, long timestamp)
执行 `storeUpsert` 方法。
UPSERT: insert new row with version=1 or update existing row with version+1.
default public BoundSql storeInsert(String namespacePath, String key, String json, long timestamp)
default
执行存储插入相关操作。
INSERT for create-only writes (version starts at 1).
default public BoundSql storeCasUpdate(String json, long timestamp, String namespacePath, String key, long expectedVersion)
default
执行 `storeCasUpdate` 方法。
Conditional UPDATE for CAS path.
default public BoundSql storeSelect(String namespacePath, String key)
default
执行存储选择相关操作。
Single-item SELECT.
default public BoundSql storeDelete(String namespacePath, String key)
default
执行存储删除相关操作。
Single-item DELETE.
default public BoundSql storeSearch(String likePattern, int limit, int offset)
default
执行存储搜索相关操作。
Namespace-prefix search with pagination.
default public char storeLikeEscapeChar()
default
返回 `storeLikeEscapeChar` 结果。
Escape character for LIKE patterns in `#storeSearch`.

方法详情Method Detail

storeTableName

default public String storeTableName()
default

返回 storeTableName 结果。

Base table name (without prefix).

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:44–46

storeCreateTableDdls

public List<String> storeCreateTableDdls()

返回 storeCreateTableDdls 结果。

DDL statements (one or more) to create the KV store table.

返回Returns List<String>
返回列出。Returns list.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:53

storeUpsert

public BoundSql storeUpsert(String namespacePath, String key, String json, long timestamp)

执行 storeUpsert 方法。

UPSERT: insert new row with version=1 or update existing row with version+1.

参数Parameters
名称Name类型Type说明Description
namespacePathString命名空间路径(类型 `String`)。The namespace path.
keyString键(类型 `String`)。The key.
jsonStringJSON(类型 `String`)。The json.
timestamplong时间戳(类型 `long`)。The timestamp.
返回Returns BoundSql
返回BoundSql。Returns bound sql.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:56

storeInsert

default public BoundSql storeInsert(String namespacePath, String key, String json, long timestamp)
default

执行存储插入相关操作。

INSERT for create-only writes (version starts at 1).

参数Parameters
名称Name类型Type说明Description
namespacePathString命名空间路径(类型 `String`)。The namespace path.
keyString键(类型 `String`)。The key.
jsonStringJSON(类型 `String`)。The json.
timestamplong时间戳(类型 `long`)。The timestamp.
返回Returns BoundSql
返回BoundSql。Returns bound sql.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:63–73

storeCasUpdate

default public BoundSql storeCasUpdate(String json, long timestamp, String namespacePath, String key, long expectedVersion)
default

执行 storeCasUpdate 方法。

Conditional UPDATE for CAS path.

参数Parameters
名称Name类型Type说明Description
jsonStringJSON(类型 `String`)。The json.
timestamplong时间戳(类型 `long`)。The timestamp.
namespacePathString命名空间路径(类型 `String`)。The namespace path.
keyString键(类型 `String`)。The key.
expectedVersionlongexpected 版本(类型 `long`)。The expected version.
返回Returns BoundSql
返回BoundSql。Returns bound sql.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:76–88

storeSelect

default public BoundSql storeSelect(String namespacePath, String key)
default

执行存储选择相关操作。

Single-item SELECT.

参数Parameters
名称Name类型Type说明Description
namespacePathString命名空间路径(类型 `String`)。The namespace path.
keyString键(类型 `String`)。The key.
返回Returns BoundSql
返回BoundSql。Returns bound sql.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:91–98

storeDelete

default public BoundSql storeDelete(String namespacePath, String key)
default

执行存储删除相关操作。

Single-item DELETE.

参数Parameters
名称Name类型Type说明Description
namespacePathString命名空间路径(类型 `String`)。The namespace path.
keyString键(类型 `String`)。The key.
返回Returns BoundSql
返回BoundSql。Returns bound sql.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:101–106

storeSearch

default public BoundSql storeSearch(String likePattern, int limit, int offset)
default

执行存储搜索相关操作。

Namespace-prefix search with pagination.

参数Parameters
名称Name类型Type说明Description
likePatternStringlike Pattern(类型 `String`)。The like pattern.
limitint数量上限(类型 `int`)。The limit.
offsetint偏移量(类型 `int`)。The offset.
返回Returns BoundSql
返回BoundSql。Returns bound sql.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:109–120

storeLikeEscapeChar

default public char storeLikeEscapeChar()
default

返回 storeLikeEscapeChar 结果。

Escape character for LIKE patterns in #storeSearch.

返回Returns char
返回char。Returns char.
源码Source io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:123–125
基于官方固定版本源码静态生成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.