Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
8700e53e
Commit
8700e53e
authored
Feb 13, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b55e94bf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
13 deletions
+27
-13
go/neo/client.go
go/neo/client.go
+13
-7
go/neo/cluster_test.go
go/neo/cluster_test.go
+13
-5
go/neo/neo.go
go/neo/neo.go
+1
-1
No files found.
go/neo/client.go
View file @
8700e53e
...
...
@@ -75,23 +75,29 @@ var _ zodb.IStorageDriver = (*Client)(nil)
//
// It will connect to master @masterAddr and identify with specified cluster name.
func
NewClient
(
clusterName
,
masterAddr
string
,
net
xnet
.
Networker
)
*
Client
{
cli
:=
&
Client
{
cli
:=
newClient
(
clusterName
,
masterAddr
,
net
)
go
cli
.
run
(
context
.
Background
())
// XXX bg hardcoded
return
cli
}
func
newClient
(
clusterName
,
masterAddr
string
,
net
xnet
.
Networker
)
*
Client
{
return
&
Client
{
node
:
NewNodeApp
(
net
,
proto
.
CLIENT
,
clusterName
,
masterAddr
,
""
),
mlinkReady
:
make
(
chan
struct
{}),
operational
:
false
,
opReady
:
make
(
chan
struct
{}),
}
}
// spawn background process which performs master talk
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
// XXX bg hardcoded
// XXX make run public?
func
(
cli
*
Client
)
run
(
ctx
context
.
Context
)
error
{
// run process which performs master talk
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
cli
.
talkMasterCancel
=
cancel
cli
.
node
.
OnShutdown
=
cancel
// XXX ok?
go
cli
.
talkMaster
(
ctx
)
return
cli
return
cli
.
talkMaster
(
ctx
)
}
func
(
c
*
Client
)
Close
()
error
{
c
.
talkMasterCancel
()
// XXX wait talkMaster finishes
...
...
go/neo/cluster_test.go
View file @
8700e53e
...
...
@@ -468,16 +468,20 @@ func TestMasterStorage(t *testing.T) {
rt
.
BranchNode
(
"m"
,
cM
)
rt
.
BranchNode
(
"s"
,
cS
)
//rt.BranchNode("c", cC) XXX - no
rt
.
BranchLink
(
"s-m"
,
cSM
,
cMS
)
rt
.
BranchLink
(
"c-m"
,
cCM
,
cMC
)
// cluster nodes
M
:=
NewMaster
(
"abc1"
,
":1"
,
Mhost
)
zstor
:=
xfs1stor
(
"../zodb/storage/fs1/testdata/1.fs"
)
S
:=
NewStorage
(
"abc1"
,
"m:1"
,
":1"
,
Shost
,
zstor
)
C
:=
newClient
(
"abc1"
,
"m:1"
,
Chost
)
// let tracer know how to map state addresses to node names
tracer
.
RegisterNode
(
M
.
node
,
"m"
)
// XXX better Mhost.Name() ?
tracer
.
RegisterNode
(
S
.
node
,
"s"
)
tracer
.
RegisterNode
(
C
.
node
,
"c"
)
...
...
@@ -617,12 +621,15 @@ func TestMasterStorage(t *testing.T) {
// ----------------------------------------
// XXX try creating client from the beginning
return
// XXX temp
// XXX try starting client from the beginning
// create client
C
:=
NewClient
(
"abc1"
,
"m:1"
,
Chost
)
tracer
.
RegisterNode
(
C
.
node
,
"c"
)
// start client
Cctx
,
Ccancel
:=
context
.
WithCancel
(
bg
)
gox
(
gwg
,
func
()
{
err
:=
C
.
run
(
Cctx
)
fmt
.
Println
(
"C err: "
,
err
)
exc
.
Raiseif
(
err
)
})
// trace
...
...
@@ -692,6 +699,7 @@ func TestMasterStorage(t *testing.T) {
_
=
Mcancel
_
=
Scancel
_
=
Ccancel
return
}
...
...
go/neo/neo.go
View file @
8700e53e
// Copyright (C) 2016-201
7
Nexedi SA and Contributors.
// Copyright (C) 2016-201
8
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
...
...
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