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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
eae3b427
Commit
eae3b427
authored
Oct 27, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d2e2c596
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
+10
-13
go/neo/client.go
go/neo/client.go
+7
-10
go/neo/neo_test.go
go/neo/neo_test.go
+1
-1
go/neo/t_cluster_test.go
go/neo/t_cluster_test.go
+2
-2
No files found.
go/neo/client.go
View file @
eae3b427
...
@@ -84,13 +84,8 @@ var _ zodb.IStorageDriver = (*Client)(nil)
...
@@ -84,13 +84,8 @@ var _ zodb.IStorageDriver = (*Client)(nil)
// NewClient creates new client node.
// NewClient creates new client node.
//
//
// It will connect to master @masterAddr and identify with specified cluster name.
// It will connect to master @masterAddr and identify with specified cluster name.
// Use Run to actually start running the node.
func
NewClient
(
clusterName
,
masterAddr
string
,
net
xnet
.
Networker
)
*
Client
{
func
NewClient
(
clusterName
,
masterAddr
string
,
net
xnet
.
Networker
)
*
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
{
return
&
Client
{
node
:
NewNodeApp
(
net
,
proto
.
CLIENT
,
clusterName
,
masterAddr
),
node
:
NewNodeApp
(
net
,
proto
.
CLIENT
,
clusterName
,
masterAddr
),
mlinkReady
:
make
(
chan
struct
{}),
mlinkReady
:
make
(
chan
struct
{}),
...
@@ -99,8 +94,9 @@ func newClient(clusterName, masterAddr string, net xnet.Networker) *Client {
...
@@ -99,8 +94,9 @@ func newClient(clusterName, masterAddr string, net xnet.Networker) *Client {
}
}
}
}
// XXX make run public?
// Run starts client node and runs it until either ctx is canceled or master
func
(
cli
*
Client
)
run
(
ctx
context
.
Context
)
error
{
// commands it to shutdown. (XXX verify M->shutdown)
func
(
cli
*
Client
)
Run
(
ctx
context
.
Context
)
error
{
// run process which performs master talk
// run process which performs master talk
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
cli
.
talkMasterCancel
=
cancel
cli
.
talkMasterCancel
=
cancel
...
@@ -253,7 +249,7 @@ func (c *Client) talkMaster1(ctx context.Context) (err error) {
...
@@ -253,7 +249,7 @@ func (c *Client) talkMaster1(ctx context.Context) (err error) {
// FIXME vvv dup from Storage.talkMaster1
// FIXME vvv dup from Storage.talkMaster1
// XXX -> node.Dial ?
// XXX -> node.Dial
/ node.DialMaster
?
if
accept
.
YourUUID
!=
c
.
node
.
MyInfo
.
UUID
{
if
accept
.
YourUUID
!=
c
.
node
.
MyInfo
.
UUID
{
log
.
Infof
(
ctx
,
"master told us to have uuid=%v"
,
accept
.
YourUUID
)
log
.
Infof
(
ctx
,
"master told us to have uuid=%v"
,
accept
.
YourUUID
)
c
.
node
.
MyInfo
.
UUID
=
accept
.
YourUUID
c
.
node
.
MyInfo
.
UUID
=
accept
.
YourUUID
...
@@ -284,7 +280,8 @@ func (c *Client) talkMaster1(ctx context.Context) (err error) {
...
@@ -284,7 +280,8 @@ func (c *Client) talkMaster1(ctx context.Context) (err error) {
})
})
// init partition table and lastTid from master
// init partition table and lastTid from master
// XXX is this needed at all or we can expect master sending us pt/head via notify channel?
// TODO better change protocol for master to send us pt/head via notify
// channel right after identification.
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
()
error
{
return
c
.
initFromMaster
(
ctx
,
mlink
)
return
c
.
initFromMaster
(
ctx
,
mlink
)
})
})
...
...
go/neo/neo_test.go
View file @
eae3b427
...
@@ -71,7 +71,7 @@ func TestMasterStorage(t0 *testing.T) {
...
@@ -71,7 +71,7 @@ func TestMasterStorage(t0 *testing.T) {
return
S
.
Run
(
ctx
)
return
S
.
Run
(
ctx
)
})
})
gwg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
gwg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
C
.
r
un
(
ctx
)
return
C
.
R
un
(
ctx
)
})
})
tM
:=
t
.
Checker
(
"m"
)
tM
:=
t
.
Checker
(
"m"
)
...
...
go/neo/t_cluster_test.go
View file @
eae3b427
...
@@ -70,7 +70,7 @@ type ITestStorage interface {
...
@@ -70,7 +70,7 @@ type ITestStorage interface {
}
}
type
ITestClient
interface
{
type
ITestClient
interface
{
r
un
(
ctx
context
.
Context
)
error
R
un
(
ctx
context
.
Context
)
error
zodb
.
IStorageDriver
zodb
.
IStorageDriver
}
}
...
@@ -196,7 +196,7 @@ func (t *TestCluster) NewStorage(name, masterAddr string, back storage.Backend)
...
@@ -196,7 +196,7 @@ func (t *TestCluster) NewStorage(name, masterAddr string, back storage.Backend)
func
(
t
*
TestCluster
)
NewClient
(
name
,
masterAddr
string
)
ITestClient
{
func
(
t
*
TestCluster
)
NewClient
(
name
,
masterAddr
string
)
ITestClient
{
node
:=
t
.
registerNewNode
(
name
)
node
:=
t
.
registerNewNode
(
name
)
c
:=
n
ewClient
(
t
.
name
,
masterAddr
,
node
.
net
)
c
:=
N
ewClient
(
t
.
name
,
masterAddr
,
node
.
net
)
t
.
gotracer
.
RegisterNode
(
c
.
node
,
name
)
t
.
gotracer
.
RegisterNode
(
c
.
node
,
name
)
return
c
return
c
}
}
...
...
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