This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 5403d93 Add metadata-repository doc (#13597)
5403d93 is described below
commit 5403d936be1d3902c80c88c64e91cc75690816a5
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Nov 14 22:20:36 2021 +0800
Add metadata-repository doc (#13597)
---
.../builtin-algorithm/metadata-repository.cn.md | 41 +++++++++++++++++++++-
.../builtin-algorithm/metadata-repository.en.md | 41 +++++++++++++++++++++-
.../shardingsphere-jdbc/java-api/data-source.cn.md | 2 ++
.../shardingsphere-jdbc/java-api/data-source.en.md | 6 ++--
.../shardingsphere-jdbc/java-api/mode.cn.md | 2 ++
.../shardingsphere-jdbc/java-api/mode.en.md | 2 ++
.../spring- namespace/mode.cn.md | 2 ++
.../spring- namespace/mode.en.md | 2 ++
.../spring-boot-starter/mode.cn.md | 2 ++
.../spring-boot-starter/mode.en.md | 2 ++
.../shardingsphere-jdbc/yaml/mode.cn.md | 2 ++
.../shardingsphere-jdbc/yaml/mode.en.md | 2 ++
.../repository/standalone/file/FileRepository.java | 16 ++++-----
13 files changed, 110 insertions(+), 12 deletions(-)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository.cn.md
index 136dcdf..a07910f 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository.cn.md
@@ -3,4 +3,43 @@ title = "元数据持久化仓库"
weight = 1
+++
-TODO
+## 文件持久化
+
+类型:File
+
+适用模式:Standalone
+
+可配置属性:
+
+| *名称* | *数据类型* | *说明* | *默认值* |
+| ---------------------------- | --------- | ---------------- |
--------------- |
+| path | String | 元数据存储路径 | .shardingsphere |
+
+## ZooKeeper 持久化
+
+类型:ZooKeeper
+
+适用模式:Cluster
+
+可配置属性:
+
+| *名称* | *数据类型* | *说明* | *默认值* |
+| ---------------------------- | --------- | ------------------ |
------------- |
+| retryIntervalMilliseconds | int | 重试间隔毫秒数 | 500 |
+| maxRetries | int | 客户端连接最大重试次数 | 3 |
+| timeToLiveSeconds | int | 临时数据失效的秒数 | 60 |
+| operationTimeoutMilliseconds | int | 客户端操作超时的毫秒数 | 500 |
+| digest | String | 登录认证密码 | |
+
+## Etcd 持久化
+
+类型:Etcd
+
+适用模式:Cluster
+
+可配置属性:
+
+| *名称* | *数据类型* | *说明* | *默认值* |
+| ---------------------------- | --------- | ------------------- |
--------------- |
+| timeToLiveSeconds | long | 临时数据失效的秒数 | 30 |
+| connectionTimeout | long | 连接超时秒数 | 30
|
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository.en.md
index 88cfef4..369a29e 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository.en.md
@@ -3,4 +3,43 @@ title = "Metadata Repository"
weight = 1
+++
-TODO
+## File Repository
+
+Type: File
+
+Mode: Standalone
+
+Attributes:
+
+| *Name* | *Type* | *Description* |
*Default Value* |
+| ---------------------------- | ------ | --------------------------------- |
--------------- |
+| path | String | Path for metadata persist |
.shardingsphere |
+
+## ZooKeeper Repository
+
+Type: ZooKeeper
+
+Mode: Cluster
+
+Attributes:
+
+| *Name* | *Type* | *Description* |
*Default Value* |
+| ---------------------------- | ------ | --------------------------------- |
--------------- |
+| retryIntervalMilliseconds | int | Milliseconds of retry interval |
500 |
+| maxRetries | int | Max retries of client connection |
3 |
+| timeToLiveSeconds | int | Seconds of ephemeral data live |
60 |
+| operationTimeoutMilliseconds | int | Milliseconds of operation timeout |
500 |
+| digest | String | Password of login |
|
+
+## Etcd Repository
+
+Type: Etcd
+
+Mode: Cluster
+
+Attributes:
+
+| *Name* | *Type* | *Description* |
*Default Value* |
+| ---------------------------- | ------ | --------------------------------- |
--------------- |
+| timeToLiveSeconds | long | Seconds of ephemeral data live |
30 |
+| connectionTimeout | long | Seconds of connection timeout |
30 |
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/data-source.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/data-source.cn.md
index 27eceff..e27d47b 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/data-source.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/data-source.cn.md
@@ -6,6 +6,8 @@ chapter = true
ShardingSphere-JDBC 支持所有的数据库 JDBC 驱动和连接池。
+## 配置示例
+
示例的数据库驱动为 MySQL,连接池为 HikariCP,可以更换为其他数据库驱动和连接池。
```java
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/data-source.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/data-source.en.md
index 40f19ee..dd8a7c3 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/data-source.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/data-source.en.md
@@ -6,11 +6,13 @@ chapter = true
ShardingSphere-JDBC Supports all JDBC drivers and database connection pools.
+## Example
+
In this example, the database driver is MySQL, and connection pool is
HikariCP, which can be replaced with other database drivers and connection
pools.
```java
Map<String, DataSource> dataSourceMap = new HashMap<>();
-
+
// Configure the 1st data source
HikariDataSource dataSource1 = new HikariDataSource();
dataSource1.setDriverClassName("com.mysql.jdbc.Driver");
@@ -18,7 +20,7 @@ dataSource1.setJdbcUrl("jdbc:mysql://localhost:3306/ds_1");
dataSource1.setUsername("root");
dataSource1.setPassword("");
dataSourceMap.put("ds_1", dataSource1);
-
+
// Configure the 2nd data source
HikariDataSource dataSource2 = new HikariDataSource();
dataSource2.setDriverClassName("com.mysql.jdbc.Driver");
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/mode.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/mode.cn.md
index 4eaa747..93a7db2 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/mode.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/mode.cn.md
@@ -39,3 +39,5 @@ chapter = true
| namespace | String | 注册中心命名空间 |
| serverLists | String | 注册中心连接地址 |
| props | Properties | 持久化仓库所需属性 |
+
+持久化仓库类型的详情,请参见[内置持久化仓库类型列表](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/)。
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/mode.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/mode.en.md
index 07d50de..73481d8 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/mode.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/mode.en.md
@@ -39,3 +39,5 @@ Attributes:
| namespace | String | Namespace of registry center |
| serverLists | String | Server lists of registry center |
| props | Properties | Properties of persist repository |
+
+Please refer to [Builtin Persist Repository
List](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/)
for more details about type of repository.
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/spring-
namespace/mode.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-
namespace/mode.cn.md
index 0ee180d..d2e144c 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/spring-
namespace/mode.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/spring-
namespace/mode.cn.md
@@ -117,3 +117,5 @@ weight = 1
</shardingsphere:data-source>
</beans>
```
+
+持久化仓库类型的详情,请参见[内置持久化仓库类型列表](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/)。
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/spring-
namespace/mode.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-
namespace/mode.en.md
index 6076c65..2e53bbe 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/spring-
namespace/mode.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/spring-
namespace/mode.en.md
@@ -117,3 +117,5 @@ Namespace:
[http://shardingsphere.apache.org/schema/shardingsphere/mode-reposito
</shardingsphere:data-source>
</beans>
```
+
+Please refer to [Builtin Persist Repository
List](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/)
for more details about type of repository.
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/mode.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/mode.cn.md
index 29dda29..7226e27 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/mode.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/mode.cn.md
@@ -38,3 +38,5 @@ spring.shardingsphere.mode.repository.serverLists= # 注册中心连接地址
spring.shardingsphere.mode.repository.props.<key>= # 持久化仓库所需属性
spring.shardingsphere.mode.overwrite= # 是否使用本地配置覆盖持久化配置
```
+
+持久化仓库类型的详情,请参见[内置持久化仓库类型列表](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/)。
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/mode.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/mode.en.md
index 2c14ee7..42f0776 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/mode.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/mode.en.md
@@ -38,3 +38,5 @@ spring.shardingsphere.mode.repository.serverLists= # Server
lists of registry ce
spring.shardingsphere.mode.repository.props.<key>= # Properties of persist
repository
spring.shardingsphere.mode.overwrite= # Whether overwrite persistent
configuration with local configuration
```
+
+Please refer to [Builtin Persist Repository
List](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/)
for more details about type of repository.
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml/mode.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml/mode.cn.md
index 42f3be0..49655ef 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml/mode.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml/mode.cn.md
@@ -46,3 +46,5 @@ mode:
bar_key: bar_value
overwrite: # 是否使用本地配置覆盖持久化配置
```
+
+持久化仓库类型的详情,请参见[内置持久化仓库类型列表](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/)。
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml/mode.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml/mode.en.md
index bdbf3d5..16c1e6e 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml/mode.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml/mode.en.md
@@ -46,3 +46,5 @@ mode:
bar_key: bar_value
overwrite: # Whether overwrite persistent configuration with local
configuration
```
+
+Please refer to [Builtin Persist Repository
List](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/)
for more details about type of repository.
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-file/src/main/java/org/apache/shardingsphere/mode/repository/standalone/file/FileRepository.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/s
[...]
index d1f9a34..ea76206 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-file/src/main/java/org/apache/shardingsphere/mode/repository/standalone/file/FileRepository.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-file/src/main/java/org/apache/shardingsphere/mode/repository/standalone/file/FileRepository.java
@@ -45,6 +45,13 @@ public final class FileRepository implements
StandalonePersistRepository {
private String path;
@Override
+ public void setProps(final Properties props) {
+ FileRepositoryProperties localRepositoryProperties = new
FileRepositoryProperties(props);
+ path = Optional.ofNullable(
+
Strings.emptyToNull(localRepositoryProperties.getValue(FileRepositoryPropertyKey.PATH))).orElse(Joiner.on("/").join(System.getProperty("user.home"),
DEFAULT_PERSIST_DIRECTORY));
+ }
+
+ @Override
public String get(final String key) {
if (!Files.exists(Paths.get(path, key))) {
return "";
@@ -88,18 +95,11 @@ public final class FileRepository implements
StandalonePersistRepository {
}
@Override
- public void close() {
- }
-
- @Override
public String getType() {
return "File";
}
@Override
- public void setProps(final Properties props) {
- FileRepositoryProperties localRepositoryProperties = new
FileRepositoryProperties(props);
- path = Optional.ofNullable(
-
Strings.emptyToNull(localRepositoryProperties.getValue(FileRepositoryPropertyKey.PATH))).orElse(Joiner.on("/").join(System.getProperty("user.home"),
DEFAULT_PERSIST_DIRECTORY));
+ public void close() {
}
}