StoreDialect
public interface StoreDialect
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 Detail
storeTableName
default public String storeTableName()
返回 storeTableName 结果。
Base table name (without prefix).
Stringio/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:44–46storeCreateTableDdls
public List<String> storeCreateTableDdls()
返回 storeCreateTableDdls 结果。
DDL statements (one or more) to create the KV store table.
List<String>io/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:53storeUpsert
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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespacePath | String | 命名空间路径(类型 `String`)。The namespace path. |
key | String | 键(类型 `String`)。The key. |
json | String | JSON(类型 `String`)。The json. |
timestamp | long | 时间戳(类型 `long`)。The timestamp. |
BoundSqlio/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:56storeInsert
default public BoundSql storeInsert(String namespacePath, String key, String json, long timestamp)
执行存储插入相关操作。
INSERT for create-only writes (version starts at 1).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespacePath | String | 命名空间路径(类型 `String`)。The namespace path. |
key | String | 键(类型 `String`)。The key. |
json | String | JSON(类型 `String`)。The json. |
timestamp | long | 时间戳(类型 `long`)。The timestamp. |
BoundSqlio/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:63–73storeCasUpdate
default public BoundSql storeCasUpdate(String json, long timestamp, String namespacePath, String key, long expectedVersion)
执行 storeCasUpdate 方法。
Conditional UPDATE for CAS path.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
timestamp | long | 时间戳(类型 `long`)。The timestamp. |
namespacePath | String | 命名空间路径(类型 `String`)。The namespace path. |
key | String | 键(类型 `String`)。The key. |
expectedVersion | long | expected 版本(类型 `long`)。The expected version. |
BoundSqlio/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:76–88storeSelect
default public BoundSql storeSelect(String namespacePath, String key)
执行存储选择相关操作。
Single-item SELECT.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespacePath | String | 命名空间路径(类型 `String`)。The namespace path. |
key | String | 键(类型 `String`)。The key. |
BoundSqlio/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:91–98storeDelete
default public BoundSql storeDelete(String namespacePath, String key)
执行存储删除相关操作。
Single-item DELETE.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
namespacePath | String | 命名空间路径(类型 `String`)。The namespace path. |
key | String | 键(类型 `String`)。The key. |
BoundSqlio/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:101–106storeSearch
default public BoundSql storeSearch(String likePattern, int limit, int offset)
执行存储搜索相关操作。
Namespace-prefix search with pagination.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
likePattern | String | like Pattern(类型 `String`)。The like pattern. |
limit | int | 数量上限(类型 `int`)。The limit. |
offset | int | 偏移量(类型 `int`)。The offset. |
BoundSqlio/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:109–120storeLikeEscapeChar
default public char storeLikeEscapeChar()
返回 storeLikeEscapeChar 结果。
Escape character for LIKE patterns in #storeSearch.
chario/agentscope/extensions/jdbc/dialect/table/StoreDialect.java:123–125