Commit a0dcc920 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c6599556
......@@ -133,6 +133,8 @@ const (
//
// 2. NodeLink.Accept() works only on server side.
// XXX vs client processing e.g. invalidation notifications from master ?
// XXX -> we could require that such listen for notification Conn is that
// one left after RequestIdentification/AcceptIdentification.
//
// Usually server role should be used for connections created via
// net.Listen/net.Accept and client role for connections created via net.Dial.
......
......@@ -31,7 +31,41 @@ type Node struct {
}
// NodeTable represents all known nodes in a cluster from local-node point of view
// NodeTable represents all known nodes in a cluster from primary master point of view
// XXX do we need "from local-node point of view" ?
//
// - Primary Master view of cluster
// - M tracks changes to nodeTab as nodes appear (connected to M) and go (disconnected from M)
// - M regularly broadcasts nodeTab content updates(?) to all nodes
// This way all nodes stay informed about their peers in cluster
//
// UC:
// - C needs to connect/talk to a storage by uuid
// - C needs to initially connect to PM (?)
// - S pulls from other S
//
//
// XXX [] of
// .nodeUUID
// .nodeType
// .nodeState
// .listenAt ip:port | ø // ø - if client or down(?)
//
// - - - - - - -
//
// .comesFrom ?(ip:port) connected to PM from here
// XXX ^^^ needed ? nodeLink has this info
//
// .nodeLink | nil M's node link to this node
// .notifyConn | nil conn left after identification phase
// M uses this to send notifications to the node
//
//
// .acceptingUpdates (?) - whether it is ok to update nodeTab (e.g. if
// master is shutting down it first sends all nodes something but has to make
// sure not to accept new connections -> XXX not needed - just stop listening
// first.
//
type NodeTable struct {
// users have to care locking explicitly
sync.Mutex // XXX -> RWMutex ?
......
......@@ -146,7 +146,7 @@ class PrimaryNotificationsHandler(MTEventHandler):
# to do the same thing for nodes in other non-running states ?
getByUUID = self.app.nm.getByUUID
for node in node_list:
if node[3] != NodeStates.RUNNING:
if node[3] != NodeStates.RUNNING: # NOTE C closes connections to other nodes if M says they are not running
node = getByUUID(node[2])
if node and node.isConnected():
node.getConnection().close()
......
......@@ -522,6 +522,7 @@ def NODE_TYPE_MAPPING():
name = camel_case(node_type)
is_name = 'is' + name
setmethod(Node, is_name, bool)
# e.g. MasterNode(Node): .is_master: true; .getType: lambda ... -> Master
node_type_dict[node_type] = cls = type(name + 'Node', bases, {
'getType': getType(node_type),
is_name: true,
......
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