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
c8857f53
Commit
c8857f53
authored
Feb 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6e6233e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
38 deletions
+4
-38
go/neo/master.go
go/neo/master.go
+4
-7
go/neo/server.go
go/neo/server.go
+0
-31
No files found.
go/neo/master.go
View file @
c8857f53
...
@@ -27,7 +27,7 @@ package neo
...
@@ -27,7 +27,7 @@ package neo
// maintains node and partition tables and broadcasts updates of those tables to
// maintains node and partition tables and broadcasts updates of those tables to
// all connected nodes. It drives cluster through recovery -> verify -> serve
// all connected nodes. It drives cluster through recovery -> verify -> serve
// cycle. It also manages commits initiated by clients and notifies clients
// cycle. It also manages commits initiated by clients and notifies clients
// about changes committed by another client.
// about changes committed by another client
(TODO)
.
//
//
// Master is organized as follows:
// Master is organized as follows:
//
//
...
@@ -75,15 +75,14 @@ type Master struct {
...
@@ -75,15 +75,14 @@ type Master struct {
mainWG
*
xsync
.
WorkGroup
mainWG
*
xsync
.
WorkGroup
// main <- node come or go
// main <- node come or go
nodeComeq
chan
nodeCome
// main <- accept "node connected"
nodeComeq
chan
nodeCome
// main <- accept "node connected"
nodeLeaveq
chan
nodeLeave
// main <- peerWG.wait "node (should be) disconnected"
nodeLeaveq
chan
nodeLeave
// main <- peerWG.wait "node (should be) disconnected"
// in addition to nodeTab (which keeps information about a node) tasks
// in addition to nodeTab (which keeps information about a node) tasks
// and mastering context that are specific to a peer are organized
// and mastering context that are specific to a peer are organized
// around peerTab[peer.nid].
// around peerTab[peer.nid].
peerTab
map
[
proto
.
NodeID
]
*
_MasteredPeer
peerTab
map
[
proto
.
NodeID
]
*
_MasteredPeer
// last allocated oid & tid
// last allocated oid & tid
// XXX how to start allocating oid from 0, not 1 ?
// XXX how to start allocating oid from 0, not 1 ?
// TODO mu
// TODO mu
...
@@ -93,7 +92,6 @@ type Master struct {
...
@@ -93,7 +92,6 @@ type Master struct {
// channels controlling main driver
// channels controlling main driver
ctlStart
chan
chan
error
// request to start cluster
ctlStart
chan
chan
error
// request to start cluster
ctlStop
chan
chan
struct
{}
// request to stop cluster
ctlStop
chan
chan
struct
{}
// request to stop cluster
ctlShutdown
chan
chan
error
// request to shutdown cluster XXX with ctx ?
// so tests could override
// so tests could override
monotime
func
()
float64
monotime
func
()
float64
...
@@ -108,7 +106,7 @@ type nodeCome struct {
...
@@ -108,7 +106,7 @@ type nodeCome struct {
// nodeLeave represents "node (should be) disconnected" event.
// nodeLeave represents "node (should be) disconnected" event.
type
nodeLeave
struct
{
type
nodeLeave
struct
{
peer
*
_MasteredPeer
peer
*
_MasteredPeer
err
error
// XXX needed ?
err
error
// disconnect due to err
}
}
// _MasteredPeer represents context for all tasks related to one peer driven by master.
// _MasteredPeer represents context for all tasks related to one peer driven by master.
...
@@ -160,7 +158,6 @@ func NewMaster(clusterName string, net xnet.Networker) *Master {
...
@@ -160,7 +158,6 @@ func NewMaster(clusterName string, net xnet.Networker) *Master {
ctlStart
:
make
(
chan
chan
error
),
ctlStart
:
make
(
chan
chan
error
),
ctlStop
:
make
(
chan
chan
struct
{}),
ctlStop
:
make
(
chan
chan
struct
{}),
ctlShutdown
:
make
(
chan
chan
error
),
nodeComeq
:
make
(
chan
nodeCome
),
nodeComeq
:
make
(
chan
nodeCome
),
nodeLeaveq
:
make
(
chan
nodeLeave
),
nodeLeaveq
:
make
(
chan
nodeLeave
),
...
...
go/neo/server.go
View file @
c8857f53
...
@@ -66,34 +66,3 @@ func Serve(ctx context.Context, l *neo.Listener, srv Server) error {
...
@@ -66,34 +66,3 @@ func Serve(ctx context.Context, l *neo.Listener, srv Server) error {
}
}
}
}
*/
*/
// ----------------------------------------
// XXX move -> master.go
/*
// reject sends rejective identification response and closes associated link
func reject(ctx context.Context, req *neonet.Request, resp proto.Msg) {
err1 := req.Reply(resp)
// XXX req.Close() ?
err2 := req.Link().Close()
err := xerr.Merge(err1, err2)
if err != nil {
log.Error(ctx, "reject:", err)
}
}
// goreject spawns reject in separate goroutine properly added/done on wg
func goreject(ctx context.Context, wg *sync.WaitGroup, req *neonet.Request, resp proto.Msg) {
wg.Add(1)
defer wg.Done()
go reject(ctx, req, resp)
}
// accept replies with acceptive identification response
// XXX spawn ping goroutine from here?
func accept(ctx context.Context, req *neonet.Request, resp proto.Msg) error {
return req.Reply(resp)
// XXX req.Close() ?
}
*/
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