Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
eae3b427
Commit
eae3b427
authored
Oct 27, 2020
by
Kirill Smelkov
1
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)
// NewClient creates new client node.
//
// 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
{
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
{}),
...
...
@@ -99,8 +94,9 @@ func newClient(clusterName, masterAddr string, net xnet.Networker) *Client {
}
}
// XXX make run public?
func
(
cli
*
Client
)
run
(
ctx
context
.
Context
)
error
{
// Run starts client node and runs it until either ctx is canceled or master
// commands it to shutdown. (XXX verify M->shutdown)
func
(
cli
*
Client
)
Run
(
ctx
context
.
Context
)
error
{
// run process which performs master talk
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
cli
.
talkMasterCancel
=
cancel
...
...
@@ -253,7 +249,7 @@ func (c *Client) talkMaster1(ctx context.Context) (err error) {
// FIXME vvv dup from Storage.talkMaster1
// XXX -> node.Dial ?
// XXX -> node.Dial
/ node.DialMaster
?
if
accept
.
YourUUID
!=
c
.
node
.
MyInfo
.
UUID
{
log
.
Infof
(
ctx
,
"master told us to have uuid=%v"
,
accept
.
YourUUID
)
c
.
node
.
MyInfo
.
UUID
=
accept
.
YourUUID
...
...
@@ -284,7 +280,8 @@ func (c *Client) talkMaster1(ctx context.Context) (err error) {
})
// 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
{
return
c
.
initFromMaster
(
ctx
,
mlink
)
})
...
...
go/neo/neo_test.go
View file @
eae3b427
...
...
@@ -71,7 +71,7 @@ func TestMasterStorage(t0 *testing.T) {
return
S
.
Run
(
ctx
)
})
gwg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
C
.
r
un
(
ctx
)
return
C
.
R
un
(
ctx
)
})
tM
:=
t
.
Checker
(
"m"
)
...
...
go/neo/t_cluster_test.go
View file @
eae3b427
...
...
@@ -70,7 +70,7 @@ type ITestStorage interface {
}
type
ITestClient
interface
{
r
un
(
ctx
context
.
Context
)
error
R
un
(
ctx
context
.
Context
)
error
zodb
.
IStorageDriver
}
...
...
@@ -196,7 +196,7 @@ func (t *TestCluster) NewStorage(name, masterAddr string, back storage.Backend)
func
(
t
*
TestCluster
)
NewClient
(
name
,
masterAddr
string
)
ITestClient
{
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
)
return
c
}
...
...
Kirill Smelkov
@kirr
mentioned in commit
114b7fd6
·
Dec 23, 2020
mentioned in commit
114b7fd6
mentioned in commit 114b7fd67d37f7e0442f8289a825d9d8ceec6b65
Toggle commit list
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