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
ca492f72
Commit
ca492f72
authored
Feb 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c8857f53
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
go/neo/master.go
go/neo/master.go
+6
-11
No files found.
go/neo/master.go
View file @
ca492f72
...
...
@@ -117,6 +117,7 @@ type _MasteredPeer struct {
node
*
xneo
.
PeerNode
// all tasks are spawned under wg. If any task fails - whole wg is canceled.
// When wg is done, main is signalled that "peer (should be) disconnected".
// cancel signals all tasks under wg to stop.
wg
*
xsync
.
WorkGroup
cancel
func
()
...
...
@@ -129,7 +130,7 @@ type _MasteredPeer struct {
// XXX no need? (peer.notify is canceled via peerWork.cancel)
notifyqOverflow
chan
struct
{}
accept
Done
chan
struct
{}
// ready after initial accept sequence is sent to the peer
accept
Sent
chan
struct
{}
// ready after initial accept sequence is sent to the peer
}
// _ΔClusterState represents δnodeTab/δpartTab/δClusterState.
...
...
@@ -138,7 +139,7 @@ type _ΔNodeTab struct {
proto
.
NodeInfo
// new value for change of 1 nodeTab entry
}
type
_ΔPartTab
struct
{
//
XXX
//
TODO
}
type
_ΔStateCode
struct
{
proto
.
ClusterState
// new value
...
...
@@ -192,12 +193,6 @@ func (m *Master) Stop() {
<-
ech
}
// Shutdown requests all known nodes in the cluster to stop.
// XXX + master's run to finish ?
func
(
m
*
Master
)
Shutdown
()
error
{
panic
(
"TODO"
)
}
// setClusterState sets .clusterState and notifies subscribers.
func
(
m
*
Master
)
setClusterState
(
state
proto
.
ClusterState
)
{
...
...
@@ -1199,7 +1194,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
// (see updateNodeTab for details)
notifyq
:
make
(
chan
_ΔClusterState
,
1024
),
notifyqOverflow
:
make
(
chan
struct
{}),
accept
Done
:
make
(
chan
struct
{}),
accept
Sent
:
make
(
chan
struct
{}),
}
m
.
peerTab
[
node
.
NID
]
=
peer
...
...
@@ -1254,7 +1249,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
// XXX send clusterState too? (NEO/py does not send it)
// indicate to run that initial acceptance is done
close
(
peer
.
accept
Done
)
close
(
peer
.
accept
Sent
)
// proxy δnodeTab,δpartTab/δclusterState from main to the peer
return
peer
.
notify
(
ctx
)
...
...
@@ -1279,7 +1274,7 @@ func (p *_MasteredPeer) run(ctx context.Context, f func() error) error {
// as that means accept0 task error, it would cancel ctx for all other
// tasks run through p.wg . And run is called with contexts whose
// cancel is derived from wg cancel - so we don't check for that. XXX
case
<-
p
.
accept
Done
:
case
<-
p
.
accept
Sent
:
return
f
()
}
}
...
...
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