Commit cdea40d3 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0fac5aed
...@@ -28,48 +28,31 @@ import ( ...@@ -28,48 +28,31 @@ import (
"time" "time"
) )
// NodeTable represents known nodes in a cluster // NodeTable represents known nodes in a cluster.
// //
// Usually Master maintains such table and provides it to other nodes to know // It is
// each other but in general use-cases can be different.
// //
// XXX vvv is about Master=main use-case: // UUID -> *Node
// //
// - Primary Master view of cluster // mapping associating node uuid with information about a node.
// - 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: // Primary use-case is that master maintains such table and provides it to
// - C needs to connect/talk to a storage by uuid // its peers to know each other:
// - C needs to initially connect to PM (?)
// - S pulls from other S
//
//
// XXX [] of
// .UUID
// .Type
// .State
// .listenAt ip:port | ø // ø - if client or down(?)
//
// - - - - - - -
// //
// .comesFrom ?(ip:port) connected to PM from here // - Primary Master view of cluster.
// XXX ^^^ needed ? nodeLink has this info // - 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.
// .nodeLink | nil M's node link to this node // This way all nodes stay informed about their peers in cluster.
// .notifyConn | nil conn left after identification phase
// M uses this to send notifications to the node
// //
// Usage examples:
// - C needs to connect/talk to a storage by uuid
// (the uuid itself is obtained from PartitionTable by oid).
// - S pulls from other S.
// //
// .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.
// //
// XXX once a node was added to NodeTable its entry never deleted: if e.g. a // NOTE once a node was added to NodeTable its entry is never deleted: if e.g.
// connection to node is lost associated entry is marked as having DOWN (XXX or UNKNOWN ?) node // a connection to node is lost associated entry is marked as having DOWN (XXX
// state. // or UNKNOWN ?) node state.
// //
// NodeTable zero value is valid empty node table. // NodeTable zero value is valid empty node table.
type NodeTable struct { type NodeTable struct {
...@@ -82,6 +65,8 @@ type NodeTable struct { ...@@ -82,6 +65,8 @@ type NodeTable struct {
} }
// XXX vvv move -> peer.go?
// even if dialing a peer failed, we'll attempt redial after this timeout // even if dialing a peer failed, we'll attempt redial after this timeout
const δtRedial = 3 * time.Second const δtRedial = 3 * time.Second
...@@ -288,7 +273,7 @@ func (p *Peer) dial(ctx context.Context) (*NodeLink, error) { ...@@ -288,7 +273,7 @@ func (p *Peer) dial(ctx context.Context) (*NodeLink, error) {
/* XXX closing .link on .state = DOWN /* XXX closing .link on .state = DOWN?
func (p *Peer) SetState(state NodeState) { func (p *Peer) SetState(state NodeState) {
// XXX lock? // XXX lock?
p.State = state p.State = state
...@@ -321,9 +306,6 @@ type Node struct { ...@@ -321,9 +306,6 @@ type Node struct {
// XXX not yet sure it is good idea // XXX not yet sure it is good idea
Conn *Conn // main connection Conn *Conn // main connection
// XXX something indicating in-flight connecting/identification
// (wish Link != nil means connected and identified)
} }
......
...@@ -30,7 +30,7 @@ import ( ...@@ -30,7 +30,7 @@ import (
// //
// It is // It is
// //
// Oid -> []Storage // Oid -> []Storage # XXX actually oid -> []uuid
// //
// mapping associating object id with list of storage nodes on where data for // mapping associating object id with list of storage nodes on where data for
// this oid should be written-to/loaded-from. This mapping is organized as follows: // this oid should be written-to/loaded-from. This mapping is organized as follows:
......
...@@ -192,7 +192,8 @@ type Address struct { ...@@ -192,7 +192,8 @@ type Address struct {
// A SHA1 hash // A SHA1 hash
type Checksum [20]byte type Checksum [20]byte
// Partition Table identifier // Partition Table identifier.
//
// Zero value means "invalid id" (<-> None in py.PPTID) // Zero value means "invalid id" (<-> None in py.PPTID)
type PTid uint64 type PTid uint64
......
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