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
d2552d96
Commit
d2552d96
authored
Mar 03, 2021
by
wangwx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move client struct to client.go
parent
fde1b715
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
19 deletions
+18
-19
client.go
database/kv/zk/client.go
+18
-0
options.go
database/kv/zk/options.go
+0
-19
No files found.
database/kv/zk/client.go
View file @
d2552d96
...
...
@@ -44,6 +44,24 @@ var (
once
sync
.
Once
)
// ZookeeperClient represents zookeeper Client Configuration
type
ZookeeperClient
struct
{
name
string
ZkAddrs
[]
string
sync
.
RWMutex
// for conn
Conn
*
zk
.
Conn
activeNumber
uint32
Timeout
time
.
Duration
Wait
sync
.
WaitGroup
valid
uint32
share
bool
reconnectCh
chan
struct
{}
eventRegistry
map
[
string
][]
*
chan
struct
{}
eventRegistryLock
sync
.
RWMutex
zkEventHandler
ZkEventHandler
Session
<-
chan
zk
.
Event
}
type
zookeeperClientPool
struct
{
sync
.
Mutex
zkClient
map
[
string
]
*
ZookeeperClient
...
...
database/kv/zk/options.go
View file @
d2552d96
...
...
@@ -18,7 +18,6 @@
package
gxzookeeper
import
(
"sync"
"time"
)
...
...
@@ -43,24 +42,6 @@ func WithZkName(name string) Option {
}
}
// ZookeeperClient represents zookeeper Client Configuration
type
ZookeeperClient
struct
{
name
string
ZkAddrs
[]
string
sync
.
RWMutex
// for conn
Conn
*
zk
.
Conn
activeNumber
uint32
Timeout
time
.
Duration
Wait
sync
.
WaitGroup
valid
uint32
share
bool
reconnectCh
chan
struct
{}
eventRegistry
map
[
string
][]
*
chan
struct
{}
eventRegistryLock
sync
.
RWMutex
zkEventHandler
ZkEventHandler
Session
<-
chan
zk
.
Event
}
type
zkClientOption
func
(
*
ZookeeperClient
)
// WithZkEventHandler sets zk Client event
...
...
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