JdbcStore
public class JdbcStore implements BaseStore
io/agentscope/extensions/jdbc/store/JdbcStore.java:48–322JDBC 存储,负责持久化与读取数据。位于 io.agentscope.extensions.jdbc.store 包,实现 BaseStore。核心成员包括 builder、get、put、putIfVersion、search、delete。
JDBC-backed BaseStore with zero inline SQL — all database-specific SQL is
delegated to StoreDialect.
Supports MySQL, PostgreSQL, SQLite, and H2 via the dialect abstraction. Business logic (CAS, namespace encoding, hash-based change detection, pagination) is completely database-agnostic.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | `JdbcStore`的构建器。 Builder for `JdbcStore`. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static Builder builder(DataSource dataSource)static | 创建构建器用于`JdbcStore`。 Creates a builder for `JdbcStore`. |
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` 方法。 Performs the put if version operation. |
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. |
方法详情Method Detail
builder
public static Builder builder(DataSource dataSource)
创建构建器用于JdbcStore。
Creates a builder for JdbcStore.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
dataSource | DataSource | 数据来源(类型 `DataSource`)。The data source. |
Builderio/agentscope/extensions/jdbc/store/JdbcStore.java:69–71get
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/extensions/jdbc/store/JdbcStore.java:88–106put
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/extensions/jdbc/store/JdbcStore.java:108–122putIfVersion
public boolean putIfVersion(List<String> namespace, String key, Map<String, Object> value, long expectedVersion)
执行 putIfVersion 方法。
Performs the put if version operation.
| 名称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/extensions/jdbc/store/JdbcStore.java:124–160search
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/extensions/jdbc/store/JdbcStore.java:162–186delete
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/extensions/jdbc/store/JdbcStore.java:188–199嵌套类详情Nested Class Detail
Builder
public static final class BuilderJdbcStore的构建器。位于 io.agentscope.extensions.jdbc.store 包。核心成员包括 dialect、objectMapper、initializeSchema、build。
Builder for JdbcStore.