Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
985c23d2
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
985c23d2
编写于
9月 03, 2020
作者:
K
kimmking
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor refactoring for repository
上级
c203065a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
13 deletion
+16
-13
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/GovernanceRepository.java
...phere/governance/repository/api/GovernanceRepository.java
+10
-0
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloRepository.java
...sphere/governance/repository/apollo/ApolloRepository.java
+0
-4
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java
...dingsphere/governance/repository/etcd/EtcdRepository.java
+3
-2
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepository.java
...ngsphere/governance/repository/nacos/NacosRepository.java
+0
-4
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepository.java
...ance/repository/zookeeper/CuratorZookeeperRepository.java
+3
-3
未找到文件。
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/GovernanceRepository.java
浏览文件 @
985c23d2
...
...
@@ -28,6 +28,16 @@ import java.util.List;
*/
public
interface
GovernanceRepository
extends
TypedSPI
{
/**
* Path separator.
*/
String
PATH_SEPARATOR
=
"/"
;
/**
* Dot separator.
*/
String
DOT_SEPARATOR
=
"."
;
/**
* Initialize governance center.
*
...
...
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloRepository.java
浏览文件 @
985c23d2
...
...
@@ -44,10 +44,6 @@ import java.util.Properties;
@Slf4j
public
final
class
ApolloRepository
implements
ConfigurationRepository
{
private
static
final
String
DOT_SEPARATOR
=
"."
;
private
static
final
String
PATH_SEPARATOR
=
"/"
;
private
final
Map
<
String
,
DataChangedEventListener
>
caches
=
new
HashMap
<>();
private
ApolloConfigWrapper
configWrapper
;
...
...
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java
浏览文件 @
985c23d2
...
...
@@ -32,6 +32,7 @@ import lombok.Getter;
import
lombok.Setter
;
import
lombok.SneakyThrows
;
import
org.apache.shardingsphere.governance.repository.api.ConfigurationRepository
;
import
org.apache.shardingsphere.governance.repository.api.GovernanceRepository
;
import
org.apache.shardingsphere.governance.repository.api.RegistryRepository
;
import
org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration
;
import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent
;
...
...
@@ -72,7 +73,7 @@ public final class EtcdRepository implements ConfigurationRepository, RegistryRe
@SneakyThrows
({
InterruptedException
.
class
,
ExecutionException
.
class
})
@Override
public
List
<
String
>
getChildrenKeys
(
final
String
key
)
{
String
prefix
=
key
+
"/"
;
String
prefix
=
key
+
PATH_SEPARATOR
;
ByteSequence
prefixByteSequence
=
ByteSequence
.
from
(
prefix
,
Charsets
.
UTF_8
);
GetOption
getOption
=
GetOption
.
newBuilder
().
withPrefix
(
prefixByteSequence
).
withSortField
(
GetOption
.
SortTarget
.
KEY
).
withSortOrder
(
GetOption
.
SortOrder
.
ASCEND
).
build
();
List
<
KeyValue
>
keyValues
=
client
.
getKVClient
().
get
(
prefixByteSequence
,
getOption
).
get
().
getKvs
();
...
...
@@ -81,7 +82,7 @@ public final class EtcdRepository implements ConfigurationRepository, RegistryRe
private
String
getSubNodeKeyName
(
final
String
prefix
,
final
String
fullPath
)
{
String
pathWithoutPrefix
=
fullPath
.
substring
(
prefix
.
length
());
return
pathWithoutPrefix
.
contains
(
"/"
)
?
pathWithoutPrefix
.
substring
(
0
,
pathWithoutPrefix
.
indexOf
(
'/'
))
:
pathWithoutPrefix
;
return
pathWithoutPrefix
.
contains
(
PATH_SEPARATOR
)
?
pathWithoutPrefix
.
substring
(
0
,
pathWithoutPrefix
.
indexOf
(
PATH_SEPARATOR
))
:
pathWithoutPrefix
;
}
@SneakyThrows
({
InterruptedException
.
class
,
ExecutionException
.
class
})
...
...
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepository.java
浏览文件 @
985c23d2
...
...
@@ -41,10 +41,6 @@ import java.util.concurrent.Executor;
@Slf4j
public
final
class
NacosRepository
implements
ConfigurationRepository
{
private
static
final
String
DOT_SEPARATOR
=
"."
;
private
static
final
String
PATH_SEPARATOR
=
"/"
;
private
ConfigService
configService
;
private
NacosProperties
nacosProperties
;
...
...
shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepository.java
浏览文件 @
985c23d2
...
...
@@ -90,7 +90,7 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
builder
.
connectionTimeoutMs
(
operationTimeoutMilliseconds
);
}
if
(!
Strings
.
isNullOrEmpty
(
digest
))
{
builder
.
authorization
(
"digest"
,
digest
.
getBytes
(
Charsets
.
UTF_8
))
builder
.
authorization
(
ZookeeperPropertyKey
.
DIGEST
.
getKey
()
,
digest
.
getBytes
(
Charsets
.
UTF_8
))
.
aclProvider
(
new
ACLProvider
()
{
@Override
...
...
@@ -229,7 +229,7 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
@Override
public
void
watch
(
final
String
key
,
final
DataChangedEventListener
listener
)
{
String
path
=
key
+
"/"
;
String
path
=
key
+
PATH_SEPARATOR
;
if
(!
caches
.
containsKey
(
path
))
{
addCacheData
(
key
);
}
...
...
@@ -253,7 +253,7 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
// CHECKSTYLE:ON
CuratorZookeeperExceptionHandler
.
handleException
(
ex
);
}
caches
.
put
(
cachePath
+
"/"
,
cache
);
caches
.
put
(
cachePath
+
PATH_SEPARATOR
,
cache
);
}
private
ChangedType
getChangedType
(
final
CuratorCacheListener
.
Type
type
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录