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
Show 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 (
...
@@ -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
}
}
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