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
a73a1f6b
Commit
a73a1f6b
authored
May 30, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4b697c4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
33 deletions
+22
-33
go/neo/master.go
go/neo/master.go
+22
-33
No files found.
go/neo/master.go
View file @
a73a1f6b
...
...
@@ -49,9 +49,9 @@ type Master struct {
clusterState
ClusterState
// channels controlling main driver
ctlStart
chan
c
tlStart
// request to start cluster
ctlStop
chan
c
tlStop
// request to stop cluster
ctlShutdown
chan
chan
error
// request to shutdown cluster XXX with ctx
too
?
ctlStart
chan
c
han
error
// request to start cluster
ctlStop
chan
c
han
error
// request to stop cluster
ctlShutdown
chan
chan
error
// request to shutdown cluster XXX with ctx ?
wantToStart
chan
chan
error
// main -> recovery
...
...
@@ -60,15 +60,6 @@ type Master struct {
nodeLeave
chan
nodeLeave
// node disconnected
}
type
ctlStart
struct
{
// XXX +ctx ?
resp
chan
error
}
type
ctlStop
struct
{
// XXX +ctx ?
resp
chan
error
}
// node connects
type
nodeCome
struct
{
...
...
@@ -96,8 +87,6 @@ func NewMaster(clusterName string) *Master {
// XXX NotifyNodeInformation to all nodes whenever nodetab changes
// XXX -> Start(), Stop()
// Start requests cluster to eventually transition into running state
// it returns an error if such transition is not currently possible (e.g. partition table is not operational)
// it returns nil if the transition began.
...
...
@@ -105,17 +94,17 @@ func NewMaster(clusterName string) *Master {
// take time and could be also automatically aborted due to cluster environment change (e.g.
// a storage node goes down)
func
(
m
*
Master
)
Start
()
error
{
ch
:=
make
(
chan
error
)
m
.
ctlStart
<-
ctlStart
{
ch
}
return
<-
ch
e
ch
:=
make
(
chan
error
)
m
.
ctlStart
<-
ech
return
<-
e
ch
}
// Stop requests cluster to eventually transition into recovery state
// XXX should be always possible ?
func
(
m
*
Master
)
Stop
()
error
{
ch
:=
make
(
chan
error
)
m
.
ctlStop
<-
ctlStop
{
ch
}
return
<-
ch
e
ch
:=
make
(
chan
error
)
m
.
ctlStop
<-
ech
return
<-
e
ch
}
// Shutdown requests all known nodes in the cluster to stop
...
...
@@ -281,7 +270,7 @@ loop:
// request to start the cluster - if ok we exit replying ok
// if not ok - we just reply not ok
case
c
:=
<-
m
.
ctlStart
:
case
ech
:=
<-
m
.
ctlStart
:
if
m
.
partTab
.
OperationalWith
(
&
m
.
nodeTab
)
{
// reply "ok to start" after whole recovery finishes
...
...
@@ -292,15 +281,15 @@ loop:
rcancel
()
defer
func
()
{
c
.
resp
<-
nil
ech
<-
nil
}()
break
loop
}
c
.
resp
<-
fmt
.
Errorf
(
"start: cluster is non-operational"
)
ech
<-
fmt
.
Errorf
(
"start: cluster is non-operational"
)
case
c
:=
<-
m
.
ctlStop
:
c
.
resp
<-
nil
// we are already recovering
case
ech
:=
<-
m
.
ctlStop
:
ech
<-
nil
// we are already recovering
case
<-
ctx
.
Done
()
:
err
=
ctx
.
Err
()
...
...
@@ -450,11 +439,11 @@ loop:
}
case
c
:=
<-
m
.
ctlStart
:
c
.
resp
<-
nil
// we are already starting
case
ech
:=
<-
m
.
ctlStart
:
ech
<-
nil
// we are already starting
case
c
:=
<-
m
.
ctlStop
:
c
.
resp
<-
nil
// ok
case
ech
:=
<-
m
.
ctlStop
:
ech
<-
nil
// ok
err
=
fmt
.
Errorf
(
"stop requested"
)
break
loop
...
...
@@ -552,11 +541,11 @@ loop:
// XXX what else ? (-> txn control at least)
case
c
:=
<-
m
.
ctlStart
:
c
.
resp
<-
nil
// we are already started
case
ech
:=
<-
m
.
ctlStart
:
ech
<-
nil
// we are already started
case
c
:=
<-
m
.
ctlStop
:
c
.
resp
<-
nil
// ok
case
ech
:=
<-
m
.
ctlStop
:
ech
<-
nil
// ok
err
=
fmt
.
Errorf
(
"stop requested"
)
break
loop
...
...
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