Versions in this module Expand all Collapse all v0 v0.1.0 Jun 23, 2021 Changes in this version + const EVENT_LEADER_DISCOVERY + const EVENT_LEADER_ECHO + const EVENT_LEADER_NOMINATE + const EVENT_LEADER_READY + const NodeDown + const NodeLeave + const NodeUp + func Broadcast(config config.NetworkConfig, req *Request) + func GetActivePeers() ([]string, map[string]*Node) + func GetLeader() string + func GetLocalActivePeersCount() int + func GetLocalPeers() map[string]*Node + func GetPeers() []string + func GetRaftStatus() string + func GetStats() map[string]string + func InitAPI() + func Open() (err error) + func RestoreClusterState() + func ServeMulticastDiscovery(config config.NetworkConfig, h func(*net.UDPAddr, int, []byte), ...) + func SnapshotClusterState() + type ClusterAPI struct + type ClusterFSM struct + func NewFSM() *ClusterFSM + func (f *ClusterFSM) Apply(l *raft.Log) interface{} + func (f *ClusterFSM) GetClusterMetadata() Metadata + func (f *ClusterFSM) Restore(rc io.ReadCloser) error + func (f *ClusterFSM) Snapshot() (raft.FSMSnapshot, error) + type Command struct + Key string + Op string + Value string + type Metadata struct + KnownNodesRPCEndpoint map[string]*Node + func GetClusterReadonlyMetadata() Metadata + type Node struct + APIEndpoint string + Active bool + ClusterName string + ID string + Name string + RPCEndpoint string + StartTime int64 + Token string + func (v *Node) GetRPCAddr() *net.TCPAddr + type NullWriter int + func (NullWriter) Write([]byte) (int, error) + type RaftModule struct + func New(config *config.ClusterConfig) *RaftModule + func (s *RaftModule) Down(raftAddr, rpcAddr string) error + func (s *RaftModule) ExecuteCommand(c *Command) error + func (s *RaftModule) Leave(raftAddr, rpcAddr string) error + func (s *RaftModule) Up(node *Node) error + type Request struct + FromNode Node + Node Node + NodeType string