Commit c8857f53 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6e6233e1
...@@ -27,7 +27,7 @@ package neo ...@@ -27,7 +27,7 @@ package neo
// maintains node and partition tables and broadcasts updates of those tables to // maintains node and partition tables and broadcasts updates of those tables to
// all connected nodes. It drives cluster through recovery -> verify -> serve // all connected nodes. It drives cluster through recovery -> verify -> serve
// cycle. It also manages commits initiated by clients and notifies clients // cycle. It also manages commits initiated by clients and notifies clients
// about changes committed by another client. // about changes committed by another client (TODO).
// //
// Master is organized as follows: // Master is organized as follows:
// //
...@@ -75,15 +75,14 @@ type Master struct { ...@@ -75,15 +75,14 @@ type Master struct {
mainWG *xsync.WorkGroup mainWG *xsync.WorkGroup
// main <- node come or go // main <- node come or go
nodeComeq chan nodeCome // main <- accept "node connected" nodeComeq chan nodeCome // main <- accept "node connected"
nodeLeaveq chan nodeLeave // main <- peerWG.wait "node (should be) disconnected" nodeLeaveq chan nodeLeave // main <- peerWG.wait "node (should be) disconnected"
// in addition to nodeTab (which keeps information about a node) tasks // in addition to nodeTab (which keeps information about a node) tasks
// and mastering context that are specific to a peer are organized // and mastering context that are specific to a peer are organized
// around peerTab[peer.nid]. // around peerTab[peer.nid].
peerTab map[proto.NodeID]*_MasteredPeer peerTab map[proto.NodeID]*_MasteredPeer
// last allocated oid & tid // last allocated oid & tid
// XXX how to start allocating oid from 0, not 1 ? // XXX how to start allocating oid from 0, not 1 ?
// TODO mu // TODO mu
...@@ -93,7 +92,6 @@ type Master struct { ...@@ -93,7 +92,6 @@ type Master struct {
// channels controlling main driver // channels controlling main driver
ctlStart chan chan error // request to start cluster ctlStart chan chan error // request to start cluster
ctlStop chan chan struct{} // request to stop cluster ctlStop chan chan struct{} // request to stop cluster
ctlShutdown chan chan error // request to shutdown cluster XXX with ctx ?
// so tests could override // so tests could override
monotime func() float64 monotime func() float64
...@@ -108,7 +106,7 @@ type nodeCome struct { ...@@ -108,7 +106,7 @@ type nodeCome struct {
// nodeLeave represents "node (should be) disconnected" event. // nodeLeave represents "node (should be) disconnected" event.
type nodeLeave struct { type nodeLeave struct {
peer *_MasteredPeer peer *_MasteredPeer
err error // XXX needed ? err error // disconnect due to err
} }
// _MasteredPeer represents context for all tasks related to one peer driven by master. // _MasteredPeer represents context for all tasks related to one peer driven by master.
...@@ -160,7 +158,6 @@ func NewMaster(clusterName string, net xnet.Networker) *Master { ...@@ -160,7 +158,6 @@ func NewMaster(clusterName string, net xnet.Networker) *Master {
ctlStart: make(chan chan error), ctlStart: make(chan chan error),
ctlStop: make(chan chan struct{}), ctlStop: make(chan chan struct{}),
ctlShutdown: make(chan chan error),
nodeComeq: make(chan nodeCome), nodeComeq: make(chan nodeCome),
nodeLeaveq: make(chan nodeLeave), nodeLeaveq: make(chan nodeLeave),
......
...@@ -66,34 +66,3 @@ func Serve(ctx context.Context, l *neo.Listener, srv Server) error { ...@@ -66,34 +66,3 @@ func Serve(ctx context.Context, l *neo.Listener, srv Server) error {
} }
} }
*/ */
// ----------------------------------------
// XXX move -> master.go
/*
// reject sends rejective identification response and closes associated link
func reject(ctx context.Context, req *neonet.Request, resp proto.Msg) {
err1 := req.Reply(resp)
// XXX req.Close() ?
err2 := req.Link().Close()
err := xerr.Merge(err1, err2)
if err != nil {
log.Error(ctx, "reject:", err)
}
}
// goreject spawns reject in separate goroutine properly added/done on wg
func goreject(ctx context.Context, wg *sync.WaitGroup, req *neonet.Request, resp proto.Msg) {
wg.Add(1)
defer wg.Done()
go reject(ctx, req, resp)
}
// accept replies with acceptive identification response
// XXX spawn ping goroutine from here?
func accept(ctx context.Context, req *neonet.Request, resp proto.Msg) error {
return req.Reply(resp)
// XXX req.Close() ?
}
*/
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