Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNumericalID ¶
GetNumericalID is used to get the numerical ID of a node from the list of peers parameters: ID (a string identifier of the node), peers (an array of current nodes in the cluster) returns: int (the numeric value of a node's indentifier), otherwise -1
Types ¶
type Store ¶
type Store struct { RaftDir string RaftBind string Raft *raft.Raft ServerID string NumericalID int PeersLength int }
Store is a type which contains node and raft information
func NewStore ¶
func NewStore() *Store
NewStore is used to initialize a Store tstruct parameters: nil returns: *Store (a pointer to a newly initialized store)
func (*Store) Join ¶
Join is called on a store type and is used to join a node to the cluster parameters: nodeID (a string used to represent a node by name), addr (a string used to denote the address to be used by the server) returns: error if an error occurs during this bootstrapping process, otherwise nil
func (*Store) Leave ¶
Leave is called on a store type and is used to remove a node from the cluster parameters: nodeID (a string used to represent a node by name) returns: error if an error occurs during this bootstrapping process, otherwise nil
func (*Store) Open ¶
Open is called on a store type and is used to boostrap the cluster parameters: enableSingle (a boolean used to allow single node cluster setup), localID (a string used to define the ID of a server) returns: error if an error occurs during this bootstrapping process, otherwise nil