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
// maintains node and partition tables and broadcasts updates of those tables to
// all connected nodes. It drives cluster through recovery -> verify -> serve
// 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:
//
...
...
@@ -75,15 +75,14 @@ type Master struct {
mainWG
*
xsync
.
WorkGroup
// main <- node come or go
nodeComeq
chan
nodeCome
// main <- accept "node connected"
nodeLeaveq
chan
nodeLeave
// main <- peerWG.wait "node (should be) disconnected"
nodeComeq
chan
nodeCome
// main <- accept "node connected"
nodeLeaveq
chan
nodeLeave
// main <- peerWG.wait "node (should be) disconnected"
// in addition to nodeTab (which keeps information about a node) tasks
// and mastering context that are specific to a peer are organized
// around peerTab[peer.nid].
peerTab
map
[
proto
.
NodeID
]
*
_MasteredPeer
// last allocated oid & tid
// XXX how to start allocating oid from 0, not 1 ?
// TODO mu
...
...
@@ -93,7 +92,6 @@ type Master struct {
// channels controlling main driver
ctlStart
chan
chan
error
// request to start cluster
ctlStop
chan
chan
struct
{}
// request to stop cluster
ctlShutdown
chan
chan
error
// request to shutdown cluster XXX with ctx ?
// so tests could override
monotime
func
()
float64
...
...
@@ -108,7 +106,7 @@ type nodeCome struct {
// nodeLeave represents "node (should be) disconnected" event.
type
nodeLeave
struct
{
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.
...
...
@@ -160,7 +158,6 @@ func NewMaster(clusterName string, net xnet.Networker) *Master {
ctlStart
:
make
(
chan
chan
error
),
ctlStop
:
make
(
chan
chan
struct
{}),
ctlShutdown
:
make
(
chan
chan
error
),
nodeComeq
:
make
(
chan
nodeCome
),
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 {
}
}
*/
// ----------------------------------------
// 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