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
e744ca3e
Commit
e744ca3e
authored
Feb 12, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6cf05c5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
go/neo/master.go
go/neo/master.go
+12
-10
No files found.
go/neo/master.go
View file @
e744ca3e
...
@@ -844,8 +844,10 @@ func storCtlVerify(ctx context.Context, stor *_MasteredPeer, pt *xneo.PartitionT
...
@@ -844,8 +844,10 @@ func storCtlVerify(ctx context.Context, stor *_MasteredPeer, pt *xneo.PartitionT
// serviceDone is the error returned after service-phase node handling is finished.
// serviceDone is the error returned after service-phase node handling is finished.
type
serviceDone
struct
{
type
serviceDone
struct
{
node
*
xneo
.
PeerNode
peer
*
_MasteredPeer
err
error
err
error
ack
chan
struct
{}
}
}
// service drives cluster during running state.
// service drives cluster during running state.
...
@@ -870,19 +872,19 @@ func (m *Master) service(ctx context.Context) (err error) {
...
@@ -870,19 +872,19 @@ func (m *Master) service(ctx context.Context) (err error) {
ctx
,
cancel
:=
xxcontext
.
Merge
/*Cancel*/
(
ctx
,
peerCtx
)
ctx
,
cancel
:=
xxcontext
.
Merge
/*Cancel*/
(
ctx
,
peerCtx
)
defer
cancel
()
defer
cancel
()
switch
node
.
Type
{
switch
peer
.
node
.
Type
{
case
proto
.
STORAGE
:
case
proto
.
STORAGE
:
err
=
storCtlService
(
ctx
,
node
)
err
=
storCtlService
(
ctx
,
peer
)
case
proto
.
CLIENT
:
case
proto
.
CLIENT
:
err
=
m
.
serveClient
(
ctx
,
node
)
err
=
m
.
serveClient
(
ctx
,
peer
)
// XXX ADMIN
// XXX ADMIN
}
}
// XXX do we need vvv ?
// XXX do we need vvv ?
ack
:=
make
(
chan
struct
{})
ack
:=
make
(
chan
struct
{})
servedq
<-
serviceDone
{
stor
:
sto
r
,
err
:
err
,
ack
:
ack
}
servedq
<-
serviceDone
{
peer
:
pee
r
,
err
:
err
,
ack
:
ack
}
<-
ack
<-
ack
// canceled service does not necessarily mean we should down the peer
// canceled service does not necessarily mean we should down the peer
...
@@ -894,10 +896,10 @@ func (m *Master) service(ctx context.Context) (err error) {
...
@@ -894,10 +896,10 @@ func (m *Master) service(ctx context.Context) (err error) {
}
}
// spawn peer serve driver (it should be only storages on entry here?)
// spawn peer serve driver (it should be only storages on entry here?)
for
_
,
peer
:=
range
m
.
peerTab
()
{
for
_
,
peer
:=
range
m
.
peerTab
{
// XXX clients? other nodes?
// XXX clients? other nodes?
// XXX note PENDING - not adding to service; ok?
// XXX note PENDING - not adding to service; ok?
if
peer
.
node
.
Type
==
proto
.
S
torage
&&
peer
.
node
.
State
==
proto
.
RUNNING
{
if
peer
.
node
.
Type
==
proto
.
S
TORAGE
&&
peer
.
node
.
State
==
proto
.
RUNNING
{
goServe
(
peer
)
goServe
(
peer
)
}
}
}
}
...
@@ -919,7 +921,7 @@ loop:
...
@@ -919,7 +921,7 @@ loop:
break
loop
break
loop
// peer (should be) disconnected
// peer (should be) disconnected
case
n
:=
<-
m
.
nodeLeave
:
case
n
:=
<-
m
.
nodeLeave
q
:
m
.
disconnectPeer
(
ctx
,
n
.
peer
)
m
.
disconnectPeer
(
ctx
,
n
.
peer
)
// if cluster became non-operational - cancel service
// if cluster became non-operational - cancel service
...
@@ -1001,7 +1003,7 @@ func storCtlService(ctx context.Context, stor *_MasteredPeer) (err error) {
...
@@ -1001,7 +1003,7 @@ func storCtlService(ctx context.Context, stor *_MasteredPeer) (err error) {
// serveClient serves incoming client link.
// serveClient serves incoming client link.
func
(
m
*
Master
)
serveClient
(
ctx
context
.
Context
,
cli
*
_MasteredPeer
)
(
err
error
)
{
func
(
m
*
Master
)
serveClient
(
ctx
context
.
Context
,
cli
*
_MasteredPeer
)
(
err
error
)
{
defer
task
.
Runningf
(
&
ctx
,
"%s: client service"
,
cli
.
node
.
NID
)(
&
err
)
defer
task
.
Runningf
(
&
ctx
,
"%s: client service"
,
cli
.
node
.
NID
)(
&
err
)
clink
:=
cli
.
Link
()
clink
:=
cli
.
node
.
Link
()
// wg, ctx := errgroup.WithContext(ctx) // XXX -> sync.WorkGroup
// wg, ctx := errgroup.WithContext(ctx) // XXX -> sync.WorkGroup
defer
xio
.
CloseWhenDone
(
ctx
,
clink
)()
// XXX -> cli.ResetLink? (better not here)
defer
xio
.
CloseWhenDone
(
ctx
,
clink
)()
// XXX -> cli.ResetLink? (better not here)
...
@@ -1209,7 +1211,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
...
@@ -1209,7 +1211,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
// XXX check nid matches NodeType
// XXX check nid matches NodeType
node
=
m
.
node
.
State
.
NodeTab
.
Get
(
nid
)
node
:
=
m
.
node
.
State
.
NodeTab
.
Get
(
nid
)
if
node
!=
nil
{
if
node
!=
nil
{
// reject - nid is already occupied by someone else
// reject - nid is already occupied by someone else
// XXX check also for down state - it could be the same node reconnecting
// XXX check also for down state - it could be the same node reconnecting
...
...
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