Commit ca492f72 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c8857f53
......@@ -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{}
acceptDone chan struct{} // ready after initial accept sequence is sent to the peer
acceptSent 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{}),
acceptDone: make(chan struct{}),
acceptSent: 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.acceptDone)
close(peer.acceptSent)
// 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.acceptDone:
case <-p.acceptSent:
return f()
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment