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
b3e86791
Commit
b3e86791
authored
Feb 23, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b022818e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
go/neo/xneo/xneo.go
go/neo/xneo/xneo.go
+11
-10
No files found.
go/neo/xneo/xneo.go
View file @
b3e86791
...
...
@@ -32,6 +32,7 @@ import (
// NodeState represent state maintained on a Node.
//
// XXX text about imaginary transactional log of state changes originated from master.
// XXX naming: review (struct and field names)
type
NodeState
struct
{
MyNID
proto
.
NodeID
// nid received by node from M XXX -> MasteredState ? (because .mlink is there ?)
IdTime
proto
.
IdTime
// when this node last identified to master
...
...
@@ -44,14 +45,14 @@ type NodeState struct {
// Clone creates new instance of NodeState initialized with previous content.
func
(
s
*
NodeState
)
Clone
()
*
NodeState
{
return
&
NodeState
{
NID
:
s
.
NID
,
MyNID
:
s
.
My
NID
,
IdTime
:
s
.
IdTime
,
ClusterState
:
s
.
ClusterState
,
// TODO ? if cloning full nodeTab/partTab becomes slow (for large
// tables) -> change to create COW reference.
NodeTab
:
s
.
NodeTab
.
Clone
(),
Pa
e
tTab
:
s
.
PartTab
.
Clone
(),
Pa
r
tTab
:
s
.
PartTab
.
Clone
(),
}
}
...
...
@@ -115,20 +116,20 @@ type Node struct {
Net
xnet
.
Networker
// network AP we are sending/receiving on
MasterAddr
string
// address of current master TODO -> masterRegistry
// XXX reconsider not using State and have just .NodeTab, .PartTab, .ClusterState
// StateMu sync.RWMutex // <- XXX unexport ? XXX not used -> move to MasteredNode ?
State
ClusterState
// nodeTab/partTab/stateCode XXX unexport?
// NodeTab *NodeTable // information about nodes in the cluster
// PartTab *PartitionTable // information about data distribution in the cluster
// ClusterState proto.ClusterState // master idea about cluster state
//
// XXX reconsider not using State and have just .NodeTab, .PartTab, .ClusterState
//
//
StateMu sync.RWMutex // <- XXX unexport ? XXX not used -> move to MasteredNode ?
//
State ClusterState // nodeTab/partTab/stateCode XXX unexport?
//
//
NodeTab *NodeTable // information about nodes in the cluster
//
//
PartTab *PartitionTable // information about data distribution in the cluster
//
//
ClusterState proto.ClusterState // master idea about cluster state
}
// NewNode creates new node.
func
NewNode
(
typ
proto
.
NodeType
,
clusterName
string
,
net
xnet
.
Networker
,
masterAddr
string
)
*
Node
{
node
:=
&
Node
{
Type
:
typ
,
State
:
{
NID
:
proto
.
NID
(
typ
,
0
),
// temp, e.g. S? TODO use "temp" bit in NodeID
State
:
NodeState
{
MyNID
:
proto
.
NID
(
typ
,
0
),
// temp, e.g. S? TODO use "temp" bit in NodeID
IdTime
:
proto
.
IdTimeNone
,
NodeTab
:
&
NodeTable
{},
...
...
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