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
fd1d1a5a
Commit
fd1d1a5a
authored
Feb 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ca492f72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
go/neo/master.go
go/neo/master.go
+17
-14
No files found.
go/neo/master.go
View file @
fd1d1a5a
...
...
@@ -193,13 +193,10 @@ func (m *Master) Stop() {
<-
ech
}
// setClusterState sets .clusterState and notifies subscribers.
func
(
m
*
Master
)
setClusterState
(
state
proto
.
ClusterState
)
{
func
(
m
*
Master
)
setClusterState
(
ctx
context
.
Context
,
state
proto
.
ClusterState
)
{
m
.
node
.
State
.
Code
.
Set
(
state
)
// TODO notify subscribers
// <- _ΔStateCode{state}
//m.notifyAll(ctx, &_ΔStateCode{state}) TODO enable
}
...
...
@@ -377,7 +374,7 @@ type storRecovery struct {
func
(
m
*
Master
)
recovery
(
ctx
context
.
Context
)
(
err
error
)
{
defer
task
.
Running
(
&
ctx
,
"recovery"
)(
&
err
)
m
.
setClusterState
(
proto
.
ClusterRecovering
)
m
.
setClusterState
(
ctx
,
proto
.
ClusterRecovering
)
ctx
,
rcancel
:=
context
.
WithCancel
(
ctx
)
defer
rcancel
()
...
...
@@ -642,7 +639,7 @@ var errClusterDegraded = errors.New("cluster became non-operatonal")
func
(
m
*
Master
)
verify
(
ctx
context
.
Context
)
(
err
error
)
{
defer
task
.
Running
(
&
ctx
,
"verify"
)(
&
err
)
m
.
setClusterState
(
proto
.
ClusterVerifying
)
m
.
setClusterState
(
ctx
,
proto
.
ClusterVerifying
)
ctx
,
vcancel
:=
context
.
WithCancel
(
ctx
)
defer
vcancel
()
...
...
@@ -849,7 +846,7 @@ type serveDone struct {
func
(
m
*
Master
)
serve
(
ctx
context
.
Context
)
(
err
error
)
{
defer
task
.
Running
(
&
ctx
,
"serve"
)(
&
err
)
m
.
setClusterState
(
proto
.
ClusterRunning
)
m
.
setClusterState
(
ctx
,
proto
.
ClusterRunning
)
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
defer
cancel
()
...
...
@@ -1037,6 +1034,7 @@ 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?
...
...
@@ -1045,13 +1043,10 @@ func (m *Master) disconnectPeer(ctx context.Context, peer *_MasteredPeer) {
m
.
updateNodeState
(
ctx
,
peer
.
node
,
proto
.
DOWN
)
}
// updateNodeTab = .nodeTab.Update + send δnodeTab to all subscribers.
// notifyAll notifies all peers about event.
// must be called from main.
// XXX place
// called from main master process. XXX
func
(
m
*
Master
)
updateNodeTab
(
ctx
context
.
Context
,
nodeInfo
proto
.
NodeInfo
)
*
xneo
.
PeerNode
{
node
:=
m
.
node
.
State
.
NodeTab
.
Update
(
nodeInfo
)
event
:=
&
_ΔNodeTab
{
nodeInfo
}
func
(
m
*
Master
)
notifyAll
(
ctx
context
.
Context
,
event
_ΔClusterState
)
{
// XXX locking
for
nid
,
peer
:=
range
m
.
peerTab
{
// TODO change limiting by buffer size to limiting by time -
...
...
@@ -1070,6 +1065,14 @@ func (m *Master) updateNodeTab(ctx context.Context, nodeInfo proto.NodeInfo) *xn
panic
(
"TODO"
)
}
}
// 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
}
...
...
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