Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gostnops
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
gostnops
Commits
048843cf
Commit
048843cf
authored
Mar 02, 2021
by
wangwx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change explanation
parent
e060257c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
client.go
database/kv/zk/client.go
+4
-4
No files found.
database/kv/zk/client.go
View file @
048843cf
...
...
@@ -52,7 +52,7 @@ type ZkEventHandler interface {
type
DefaultHandler
struct
{
}
//
nolint
//
StateToString will transfer zk state to string
func
StateToString
(
state
zk
.
State
)
string
{
switch
state
{
case
zk
.
StateDisconnected
:
...
...
@@ -86,6 +86,7 @@ func initZookeeperClientPool() {
zkClientPool
.
zkClient
=
make
(
map
[
string
]
*
ZookeeperClient
)
}
//NewZookeeperClient will create a ZookeeperClient
func
NewZookeeperClient
(
name
string
,
zkAddrs
[]
string
,
share
bool
,
opts
...
ZkClientOption
)
(
*
ZookeeperClient
,
error
)
{
if
share
{
once
.
Do
(
initZookeeperClientPool
)
...
...
@@ -346,7 +347,7 @@ func (z *ZookeeperClient) CreateTempWithValue(basePath string, value []byte) err
return
nil
}
//
nolint
//
Delete will delete basePath
func
(
z
*
ZookeeperClient
)
Delete
(
basePath
string
)
error
{
err
:=
ErrNilZkClientConn
conn
:=
z
.
getConn
()
...
...
@@ -495,7 +496,7 @@ func (z *ZookeeperClient) GetContent(zkPath string) ([]byte, *zk.Stat, error) {
return
z
.
Conn
.
Get
(
zkPath
)
}
//
nolint
//
SetContent set content of zkPath
func
(
z
*
ZookeeperClient
)
SetContent
(
zkPath
string
,
content
[]
byte
,
version
int32
)
(
*
zk
.
Stat
,
error
)
{
return
z
.
Conn
.
Set
(
zkPath
,
content
,
version
)
}
...
...
@@ -520,7 +521,6 @@ func (z *ZookeeperClient) GetEventHandler() ZkEventHandler {
return
z
.
zkEventHandler
}
// In my opinion, this method should never called by user, here just for lint
func
(
z
*
ZookeeperClient
)
Close
()
{
if
z
.
share
{
zkClientPool
.
Lock
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment