Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
5a6ce3e2
Commit
5a6ce3e2
authored
Jan 28, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
598538fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
30 deletions
+32
-30
go/neo/mastered.go
go/neo/mastered.go
+30
-28
go/neo/neonet/connection.go
go/neo/neonet/connection.go
+2
-2
No files found.
go/neo/mastered.go
View file @
5a6ce3e2
...
...
@@ -40,7 +40,10 @@ import (
// _MasteredNode provides base functioanlity of a NEO node driven by master.
//
// talkMaster persists connection to master node, adn receives update from M
// XXX requests/notifications from master go through filter that handles
// nodeTab/partTab/ClusterState changes ...
//
// talkMaster persists connection to master node, and receives update from M
// about δNodeTab, δPartTab, ClusterState.
//
// XXX how to use
...
...
@@ -110,10 +113,12 @@ func newMasteredNode(typ proto.NodeType, clusterName string, net xnet.Networker,
// talkMaster dials master, identifies to it, and receives master updates to
// node/partition tables and cluster state.
// talkMaster dials master, identifies to it, and receives master notifications and requests.
//
// Notifications to node/partition tables and cluster state are automatically
// handled, while other notifications and requests are passed through to RecvM1.
//
//
XXX connection to master is persisted (redial)
//
The connection to master is persisted by redial as needed.
func
(
node
*
_MasteredNode
)
talkMaster
(
ctx
context
.
Context
)
(
err
error
)
{
defer
task
.
Runningf
(
&
ctx
,
"talk master(%s)"
,
node
.
MasterAddr
)(
&
err
)
...
...
@@ -136,7 +141,7 @@ func (node *_MasteredNode) talkMaster(ctx context.Context) (err error) {
}
}
func
(
node
*
_MasteredNode
)
talkMaster1
(
ctx
context
.
Context
)
(
err
error
)
{
func
(
node
*
_MasteredNode
)
talkMaster1
(
ctx
context
.
Context
)
error
{
reqID
:=
&
proto
.
RequestIdentification
{
NodeType
:
node
.
myInfo
.
Type
,
NID
:
node
.
myInfo
.
NID
,
...
...
@@ -151,7 +156,7 @@ func (node *_MasteredNode) talkMaster1(ctx context.Context) (err error) {
return
err
}
err
=
xcontext
.
WithCloseOnErrCancel
(
ctx
,
mlink
,
func
()
error
{
return
xcontext
.
WithCloseOnErrCancel
(
ctx
,
mlink
,
func
()
(
err
error
)
{
if
accept
.
YourNID
!=
node
.
myInfo
.
NID
{
log
.
Infof
(
ctx
,
"master told us to have nid=%s"
,
accept
.
YourNID
)
node
.
myInfo
.
NID
=
accept
.
YourNID
// XXX locking ?
...
...
@@ -179,35 +184,32 @@ func (node *_MasteredNode) talkMaster1(ctx context.Context) (err error) {
// update cluster state
// XXX locking
err
:=
node
.
updateNodeTab
(
ctx
,
&
mnt
)
if
err
!=
nil
{
return
err
}
node
.
stateMu
.
Lock
()
err
=
node
.
updateNodeTab
(
ctx
,
&
mnt
)
node
.
state
.
PartTab
=
pt
// XXX update "operational"
node
.
stateMu
.
Unlock
()
if
err
!=
nil
{
// might be command to shutdown
return
err
}
// XXX update .masterLink + notify waiters
return
nil
// receive and handle notifications from master
defer
task
.
Running
(
&
ctx
,
"rx"
)(
&
err
)
for
{
req
,
err
:=
mlink
.
Recv1
()
if
err
!=
nil
{
return
err
}
err
=
node
.
recvMaster1
(
ctx
,
req
.
Msg
)
req
.
Close
()
if
err
!=
nil
{
return
err
}
}
})
if
err
!=
nil
{
// XXX
}
// receive and handle notifications from master
// XXX put inside ^^^ ?
defer
task
.
Running
(
&
ctx
,
"rx"
)(
&
err
)
for
{
req
,
err
:=
mlink
.
Recv1
()
if
err
!=
nil
{
return
err
}
err
=
node
.
recvMaster1
(
ctx
,
req
.
Msg
)
req
.
Close
()
if
err
!=
nil
{
return
err
}
}
}
// recvMaster1 handles 1 message from master.
...
...
go/neo/neonet/connection.go
View file @
5a6ce3e2
...
...
@@ -168,8 +168,8 @@ type NodeLink struct {
// Encoding returns protocol encoding with which the link was handshaked. XXX
// XXX place
func
(
nl
*
NodeLink
)
Encoding
()
proto
.
Encoding
{
return
nl
.
enc
func
(
link
*
NodeLink
)
Encoding
()
proto
.
Encoding
{
return
link
.
enc
}
// XXX rx handoff make latency better for serial request-reply scenario but
...
...
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