Commit b3e86791 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b022818e
......@@ -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.MyNID,
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(),
PaetTab: s.PartTab.Clone(),
PartTab: 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{},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment