Commit e7446b47 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d3ea97c7
...@@ -85,7 +85,7 @@ const ( ...@@ -85,7 +85,7 @@ const (
δPartTabPassThrough _MasteredNodeFlags = iota δPartTabPassThrough _MasteredNodeFlags = iota
) )
// XXX doc // newMasteredNode creats new _MasteredNode that connects to masterAddr/cluster via net.
func newMasteredNode(typ proto.NodeType, clusterName string, net xnet.Networker, masterAddr string) *_MasteredNode { func newMasteredNode(typ proto.NodeType, clusterName string, net xnet.Networker, masterAddr string) *_MasteredNode {
node := &_MasteredNode{ node := &_MasteredNode{
Node: xneo.NewNode(typ, clusterName, net, masterAddr), Node: xneo.NewNode(typ, clusterName, net, masterAddr),
...@@ -106,8 +106,6 @@ func newMasteredNode(typ proto.NodeType, clusterName string, net xnet.Networker, ...@@ -106,8 +106,6 @@ func newMasteredNode(typ proto.NodeType, clusterName string, net xnet.Networker,
// f is called on every reconnection to master after identification and protocol prologue. // f is called on every reconnection to master after identification and protocol prologue.
// //
// See top-level _MasteredNode overview for details. // See top-level _MasteredNode overview for details.
//
// XXX -> FollowMaster? AdhereMaster?
func (node *_MasteredNode) TalkMaster(ctx context.Context, f func(context.Context, *_MasterLink) error) (err error) { func (node *_MasteredNode) TalkMaster(ctx context.Context, f func(context.Context, *_MasterLink) error) (err error) {
// start logging with initial NID (that might be temporary, and which master can tell us to change) // start logging with initial NID (that might be temporary, and which master can tell us to change)
ctx0 := ctx ctx0 := ctx
...@@ -158,7 +156,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func( ...@@ -158,7 +156,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
node.MyInfo.NID = accept.YourNID // XXX locking ? -> opMu ? node.MyInfo.NID = accept.YourNID // XXX locking ? -> opMu ?
} }
// XXX verify Mnid = M*; our nid corresponds to our type // TODO verify Mnid = M*; our nid corresponds to our type
// rebuild nicer task now - when we know both our and master NIDs // rebuild nicer task now - when we know both our and master NIDs
// e.g. "C?: talk master(127.0.0.1:21484)" -> "C1: talk M1". // e.g. "C?: talk master(127.0.0.1:21484)" -> "C1: talk M1".
...@@ -177,7 +175,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func( ...@@ -177,7 +175,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
// partTab (not to S and secondary M(?)) // partTab (not to S and secondary M(?))
// https://lab.nexedi.com/nexedi/neoppod/blob/v1.12-69-gd98205d0/neo/master/handlers/__init__.py#L60-67 // https://lab.nexedi.com/nexedi/neoppod/blob/v1.12-69-gd98205d0/neo/master/handlers/__init__.py#L60-67
pt := node.State.PartTab pt := node.State.PartTab
if !(node.MyInfo.Type == proto.STORAGE) { // XXX -> use flag instead? if !(node.MyInfo.Type == proto.STORAGE) {
mpt := proto.SendPartitionTable{} mpt := proto.SendPartitionTable{}
_, err = mlink.Expect1(&mpt) _, err = mlink.Expect1(&mpt)
if err != nil { if err != nil {
...@@ -220,7 +218,7 @@ type _MasterLink struct { ...@@ -220,7 +218,7 @@ type _MasterLink struct {
// Must be called only when master link is established - e.g. from under TalkMaster. // Must be called only when master link is established - e.g. from under TalkMaster.
func (mlink *_MasterLink) Recv1(ctx context.Context) (neonet.Request, error) { func (mlink *_MasterLink) Recv1(ctx context.Context) (neonet.Request, error) {
for { for {
req, err := mlink.NodeLink.Recv1() // cancel on ctx req, err := mlink.NodeLink.Recv1() // XXX cancel on ctx
if err != nil { if err != nil {
return neonet.Request{}, err return neonet.Request{}, err
} }
...@@ -391,7 +389,6 @@ func (node *_MasteredNode) updateNodeTab(ctx context.Context, msg *proto.NotifyN ...@@ -391,7 +389,6 @@ func (node *_MasteredNode) updateNodeTab(ctx context.Context, msg *proto.NotifyN
} }
} }
// XXX logging under lock ok?
log.Infof(ctx, "full nodetab:\n%s", node.State.NodeTab) log.Infof(ctx, "full nodetab:\n%s", node.State.NodeTab)
return nil return nil
} }
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