Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSnapshot ¶
func NewSnapshot(data []byte) *snapshot
Types ¶
type Command ¶
type Command struct { Operation OperationType `json:"operation,omitempty" bson:"operation,omitempty"` // Contains the rest of the data Data json.RawMessage `json:"data,omitempty" bson:"data,omitempty"` }
This is a wrapper to propagate the changes to all nodes
type ConfigFSM ¶
type ConfigFSM struct {
// contains filtered or unexported fields
}
TODO: Optimise and check proper concurency
func NewConfigFSM ¶
func NewConfigFSM( dht dht.DHT, rStore *routestore.RouteStore, log *zap.Logger, ) *ConfigFSM
func (*ConfigFSM) Apply ¶
Apply log is invoked once a log entry is committed. It returns a value which will be made available in the ApplyFuture returned by Raft.Apply method if that method was called on the same Raft node as the FSM.
func (*ConfigFSM) GetLastUpdatedTime ¶
func (*ConfigFSM) Restore ¶
func (c *ConfigFSM) Restore(r io.ReadCloser) error
Restore is used to restore an FSM from a Snapshot. It is not called concurrently with any other command. The FSM must discard all previous state.
func (*ConfigFSM) SetChangeHandler ¶
type ConfigSnapshot ¶
type ConfigSnapshot struct {
Shards map[dht.ShardID]dht.ShardLocation `json:"slots,omitempty" bson:"slots,omitempty"`
}
ConfigSnapshot is a snapshot of the current state of the node. It is replicated across all the nodes in the cluster with Raft.
type NodeConfig ¶
type OperationType ¶
type OperationType int
const ( // In this case, the Data will contain the JSON snapshot of DHT map. SlotVsNodeChange OperationType = 1 // Data will contain the JSON snapshot of the DHT map. // As opposed to SlotVsNodeChange, this message means that the nodes are being initialised for the first time InitialiseNodes OperationType = 2 // Add route information AddRoute OperationType = 3 // Remove route information RemoveRoute OperationType = 4 )
Click to show internal directories.
Click to hide internal directories.