Commit 915cb69a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 03a6d5f4
...@@ -125,10 +125,12 @@ const ( ...@@ -125,10 +125,12 @@ const (
// NodeUUID is a node identifier, 4-bytes signed integer // NodeUUID is a node identifier, 4-bytes signed integer
// //
// High-order byte: // High-order byte:
// 7 6 5 4 3 2 1 0 //
// | | | | +-+-+-+-- reserved (0) // 7 6 5 4 3 2 1 0
// | +-+-+---------- node type // | | | | +-+-+-+-- reserved (0)
// +---------------- temporary if negative // | +-+-+---------- node type
// +---------------- temporary if negative
//
// UUID namespaces are required to prevent conflicts when the master generate // UUID namespaces are required to prevent conflicts when the master generate
// new uuid before it knows uuid of existing storage nodes. So only the high // new uuid before it knows uuid of existing storage nodes. So only the high
// order bit is really important and the 31 other bits could be random. // order bit is really important and the 31 other bits could be random.
......
...@@ -68,6 +68,7 @@ type Master struct { ...@@ -68,6 +68,7 @@ type Master struct {
// NewMaster creates new master node that will listen on serveAddr. // NewMaster creates new master node that will listen on serveAddr.
//
// Use Run to actually start running the node. // Use Run to actually start running the node.
func NewMaster(clusterName, serveAddr string, net xnet.Networker) *Master { func NewMaster(clusterName, serveAddr string, net xnet.Networker) *Master {
m := &Master{ m := &Master{
...@@ -86,19 +87,22 @@ func NewMaster(clusterName, serveAddr string, net xnet.Networker) *Master { ...@@ -86,19 +87,22 @@ func NewMaster(clusterName, serveAddr string, net xnet.Networker) *Master {
return m return m
} }
// Start requests cluster to eventually transition into running state // Start requests cluster to eventually transition into running state.
// it returns an error if such transition is not currently possible to begin (e.g. partition table is not operational) //
// it returns nil if the transition began. // It returns an error if such transition is not currently possible to begin
// (e.g. partition table is not operational).
// It returns nil if the transition began.
//
// NOTE upon successful return cluster is not yet in running state - the transition will // NOTE upon successful return cluster is not yet in running state - the transition will
// take time and could be also automatically aborted due to cluster environment change (e.g. // take time and could be also automatically aborted due to cluster environment change (e.g.
// a storage node goes down) // a storage node goes down).
func (m *Master) Start() error { func (m *Master) Start() error {
ech := make(chan error) ech := make(chan error)
m.ctlStart <- ech m.ctlStart <- ech
return <-ech return <-ech
} }
// Stop requests cluster to eventually transition into recovery state // Stop requests cluster to eventually transition into recovery state.
func (m *Master) Stop() { func (m *Master) Stop() {
ech := make(chan struct{}) ech := make(chan struct{})
m.ctlStop <- ech m.ctlStop <- ech
......
...@@ -37,7 +37,7 @@ import ( ...@@ -37,7 +37,7 @@ import (
"lab.nexedi.com/kirr/go123/xerr" "lab.nexedi.com/kirr/go123/xerr"
) )
// Storage is NEO node that keeps data and provides read/write access to it // Storage is NEO node that keeps data and provides read/write access to it via network.
type Storage struct { type Storage struct {
node *neo.NodeApp node *neo.NodeApp
...@@ -59,6 +59,7 @@ type Storage struct { ...@@ -59,6 +59,7 @@ type Storage struct {
} }
// NewStorage creates new storage node that will listen on serveAddr and talk to master on masterAddr. // NewStorage creates new storage node that will listen on serveAddr and talk to master on masterAddr.
//
// The storage uses zstor as underlying backend for storing data. // The storage uses zstor as underlying backend for storing data.
// Use Run to actually start running the node. // Use Run to actually start running the node.
func NewStorage(clusterName, masterAddr, serveAddr string, net xnet.Networker, zstor zodb.IStorage) *Storage { func NewStorage(clusterName, masterAddr, serveAddr string, net xnet.Networker, zstor zodb.IStorage) *Storage {
......
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