Commit b23c7153 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 62cc33a5
......@@ -27,17 +27,16 @@ import (
"math"
"os"
"sync"
"time"
)
// Master is a node overseeing and managing how whole NEO cluster works
type Master struct {
clusterName string
nodeUUID NodeUUID // my node uuid; XXX init somewhere
nodeUUID NodeUUID
// master manages node and partition tables and broadcast their updates
// to all nodes in cluster
stateMu sync.RWMutex
stateMu sync.RWMutex // XXX recheck: needed ?
nodeTab NodeTable
partTab PartitionTable
clusterState ClusterState
......@@ -45,7 +44,8 @@ type Master struct {
// channels from various workers to main driver
nodeCome chan nodeCome // node connected
nodeLeave chan nodeLeave // node disconnected
storRecovery chan storRecovery // storage node passed recovery
storRecovery chan storRecovery // storage node passed recovery XXX better explicitly pass to worker as arg?
}
......@@ -82,16 +82,6 @@ func (m *Master) SetClusterState(state ClusterState) {
// XXX actions ?
}
// monotime returns time passed since program start
// it uses monothonic time and is robust to OS clock adjustments
// XXX place?
func monotime() float64 {
// time.Sub uses monotonic clock readings for the difference
return time.Now().Sub(tstart).Seconds()
}
var tstart time.Time = time.Now()
// run implements main master cluster management logic: node tracking, cluster
// state updates, scheduling data movement between storage nodes etc
func (m *Master) run(ctx context.Context) {
......
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
package neo
// time related utilities
import (
"time"
)
// monotime returns time passed since program start
// it uses monothonic time for measurments and is robust to OS clock adjustments
//
// XXX better return time.Duration?
func monotime() float64 {
// time.Sub uses monotonic clock readings for the difference
return time.Now().Sub(tstart).Seconds()
}
var tstart time.Time = time.Now()
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