Commit c8857f53 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6e6233e1
......@@ -27,7 +27,7 @@ package neo
// maintains node and partition tables and broadcasts updates of those tables to
// all connected nodes. It drives cluster through recovery -> verify -> serve
// 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:
//
......@@ -75,15 +75,14 @@ type Master struct {
mainWG *xsync.WorkGroup
// main <- node come or go
nodeComeq chan nodeCome // main <- accept "node connected"
nodeLeaveq chan nodeLeave // main <- peerWG.wait "node (should be) disconnected"
nodeComeq chan nodeCome // main <- accept "node connected"
nodeLeaveq chan nodeLeave // main <- peerWG.wait "node (should be) disconnected"
// in addition to nodeTab (which keeps information about a node) tasks
// and mastering context that are specific to a peer are organized
// around peerTab[peer.nid].
peerTab map[proto.NodeID]*_MasteredPeer
// last allocated oid & tid
// XXX how to start allocating oid from 0, not 1 ?
// TODO mu
......@@ -93,7 +92,6 @@ type Master struct {
// channels controlling main driver
ctlStart chan chan error // request to start cluster
ctlStop chan chan struct{} // request to stop cluster
ctlShutdown chan chan error // request to shutdown cluster XXX with ctx ?
// so tests could override
monotime func() float64
......@@ -108,7 +106,7 @@ type nodeCome struct {
// nodeLeave represents "node (should be) disconnected" event.
type nodeLeave struct {
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.
......@@ -160,7 +158,6 @@ func NewMaster(clusterName string, net xnet.Networker) *Master {
ctlStart: make(chan chan error),
ctlStop: make(chan chan struct{}),
ctlShutdown: make(chan chan error),
nodeComeq: make(chan nodeCome),
nodeLeaveq: make(chan nodeLeave),
......
......@@ -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