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
030b0056
Commit
030b0056
authored
Feb 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e88063c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
31 deletions
+25
-31
go/neo/master.go
go/neo/master.go
+25
-31
No files found.
go/neo/master.go
View file @
030b0056
...
...
@@ -898,7 +898,7 @@ func (m *Master) serve(ctx context.Context) (err error) {
ctlStop
=
nil
nodeComeq
=
nil
//
XXX tell storages to stop
//
TODO tell storages to stop serving
}
for
inprogress
>
0
{
...
...
@@ -941,7 +941,7 @@ func (m *Master) serve(ctx context.Context) (err error) {
return
err
}
// storCtlServe drives a storage node during cluster serve state
// storCtlServe drives a storage node during cluster serve state
.
func
storCtlServe
(
ctx
context
.
Context
,
stor
*
_MasteredPeer
)
(
err
error
)
{
defer
task
.
Runningf
(
&
ctx
,
"%s serve"
,
stor
.
node
.
NID
)(
&
err
)
slink
:=
stor
.
node
.
Link
()
...
...
@@ -959,8 +959,9 @@ func storCtlServe(ctx context.Context, stor *_MasteredPeer) (err error) {
//if err != nil {
// return err
//}
//req.Close() XXX must be after req handling
//switch msg := req.Msg.(type) {
//msg := req.Msg
//req.Close()
//switch msg := msg.(type) {
//case *proto.NotifyReady:
// // ok
//case *proto.Error:
...
...
@@ -974,12 +975,11 @@ func storCtlServe(ctx context.Context, stor *_MasteredPeer) (err error) {
// TODO this should be also controlling transactions
for
{
select
{
// XXX stub
case
<-
time
.
After
(
1
*
time
.
Second
)
:
//println(".")
case
<-
ctx
.
Done
()
:
//
FIXME
also send StopOperation
//
TODO
also send StopOperation
return
ctx
.
Err
()
}
}
...
...
@@ -1024,18 +1024,33 @@ func (m *Master) serveClient1(ctx context.Context, req proto.Msg) (resp proto.Ms
// disconnectPeer resets link to the peer and sets its state to DOWN in nodeTab.
// other peers are notified with δnodeTab about it.
// must be called from main.
// XXX place=?
func
(
m
*
Master
)
disconnectPeer
(
ctx
context
.
Context
,
peer
*
_MasteredPeer
)
{
// XXX log?
log
.
Infof
(
ctx
,
"disconnecting %s"
,
peer
.
node
.
NID
)
peer
.
node
.
ResetLink
(
ctx
)
delete
(
m
.
peerTab
,
peer
.
node
.
NID
)
m
.
updateNodeState
(
ctx
,
peer
.
node
,
proto
.
DOWN
)
}
//
notifyAll notifies all peers about event
.
//
updateNodeTab = .nodeTab.Update + send δnodeTab to all subscribers
.
// must be called from main.
// XXX place
func
(
m
*
Master
)
updateNodeTab
(
ctx
context
.
Context
,
nodeInfo
proto
.
NodeInfo
)
*
xneo
.
PeerNode
{
node
:=
m
.
node
.
State
.
NodeTab
.
Update
(
nodeInfo
)
m
.
notifyAll
(
ctx
,
&
_ΔNodeTab
{
nodeInfo
})
return
node
}
// XXX place
// XXX doc
func
(
m
*
Master
)
updateNodeState
(
ctx
context
.
Context
,
node
*
xneo
.
PeerNode
,
state
proto
.
NodeState
)
{
nodei
:=
node
.
NodeInfo
// XXX skip if .State == state ?
nodei
.
State
=
state
m
.
updateNodeTab
(
ctx
,
nodei
)
}
// notifyAll notifies all peers about event.
// XXX place
func
(
m
*
Master
)
notifyAll
(
ctx
context
.
Context
,
event
_ΔClusterState
)
{
// XXX locking
for
nid
,
peer
:=
range
m
.
peerTab
{
...
...
@@ -1057,24 +1072,6 @@ func (m *Master) notifyAll(ctx context.Context, event _ΔClusterState) {
}
// updateNodeTab = .nodeTab.Update + send δnodeTab to all subscribers.
// must be called from main.
// XXX place
func
(
m
*
Master
)
updateNodeTab
(
ctx
context
.
Context
,
nodeInfo
proto
.
NodeInfo
)
*
xneo
.
PeerNode
{
node
:=
m
.
node
.
State
.
NodeTab
.
Update
(
nodeInfo
)
m
.
notifyAll
(
ctx
,
&
_ΔNodeTab
{
nodeInfo
})
return
node
}
// XXX place
// XXX doc
func
(
m
*
Master
)
updateNodeState
(
ctx
context
.
Context
,
node
*
xneo
.
PeerNode
,
state
proto
.
NodeState
)
{
nodei
:=
node
.
NodeInfo
// XXX skip if .State == state ?
nodei
.
State
=
state
m
.
updateNodeTab
(
ctx
,
nodei
)
}
// ----------------------------------------
...
...
@@ -1336,10 +1333,7 @@ func (p *_MasteredPeer) notify(ctx context.Context) (err error) {
return
nil
}
// allocNID allocates new node ID for a node of kind nodeType.
// XXX it is bad idea for master to assign node ID to coming node
// -> better nodes generate really unique UUID themselves and always show with them
func
(
m
*
Master
)
allocNID
(
nodeType
proto
.
NodeType
)
proto
.
NodeID
{
for
num
:=
int32
(
1
);
num
<
1
<<
24
;
num
++
{
nid
:=
proto
.
NID
(
nodeType
,
num
)
...
...
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