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
e7446b47
Commit
e7446b47
authored
Feb 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d3ea97c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
go/neo/mastered.go
go/neo/mastered.go
+6
-9
No files found.
go/neo/mastered.go
View file @
e7446b47
...
...
@@ -85,7 +85,7 @@ const (
δ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
{
node
:=
&
_MasteredNode
{
Node
:
xneo
.
NewNode
(
typ
,
clusterName
,
net
,
masterAddr
),
...
...
@@ -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.
//
// 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
)
{
// start logging with initial NID (that might be temporary, and which master can tell us to change)
ctx0
:=
ctx
...
...
@@ -144,8 +142,8 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
Address
:
node
.
MyInfo
.
Addr
,
ClusterName
:
node
.
ClusterName
,
IdTime
:
node
.
MyInfo
.
IdTime
,
// XXX ok?
DevPath
:
nil
,
// XXX stub
NewNID
:
nil
,
// XXX stub
DevPath
:
nil
,
// XXX stub
NewNID
:
nil
,
// XXX stub
}
mlink
,
accept
,
err
:=
xneo
.
Dial
(
ctx
,
proto
.
MASTER
,
node
.
Net
,
node
.
MasterAddr
,
reqID
)
if
err
!=
nil
{
...
...
@@ -158,7 +156,7 @@ func (node *_MasteredNode) talkMaster1(ctx, ctxPreTalkM context.Context, f func(
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
// 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(
// 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
pt
:=
node
.
State
.
PartTab
if
!
(
node
.
MyInfo
.
Type
==
proto
.
STORAGE
)
{
// XXX -> use flag instead?
if
!
(
node
.
MyInfo
.
Type
==
proto
.
STORAGE
)
{
mpt
:=
proto
.
SendPartitionTable
{}
_
,
err
=
mlink
.
Expect1
(
&
mpt
)
if
err
!=
nil
{
...
...
@@ -220,7 +218,7 @@ type _MasterLink struct {
// Must be called only when master link is established - e.g. from under TalkMaster.
func
(
mlink
*
_MasterLink
)
Recv1
(
ctx
context
.
Context
)
(
neonet
.
Request
,
error
)
{
for
{
req
,
err
:=
mlink
.
NodeLink
.
Recv1
()
// cancel on ctx
req
,
err
:=
mlink
.
NodeLink
.
Recv1
()
//
XXX
cancel on ctx
if
err
!=
nil
{
return
neonet
.
Request
{},
err
}
...
...
@@ -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
)
return
nil
}
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