Documentation ¶
Index ¶
Constants ¶
const ( CommandAddConsistentHashEntry = "ADD_CONSISTENT_HASH_ENTRY" RaftLeaderState = raft.Leader LeaderElectionTimeout = 3 * time.Second )
Configuration constants for Raft operations.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsistentHashCommand ¶
type ConsistentHashCommand struct { Type string `json:"type"` Hash uint64 `json:"hash"` BlockName string `json:"blockName"` }
ConsistentHashCommand represents a command to modify the consistent hash.
type FSM ¶
type FSM struct {
// contains filtered or unexported fields
}
FSM represents the Finite State Machine for the Raft cluster.
func (*FSM) GetProxyBlock ¶
GetProxyBlock safely retrieves the block name for a given hash.
type FSMSnapshot ¶
type FSMSnapshot struct {
// contains filtered or unexported fields
}
FSMSnapshot represents a snapshot of the FSM.
func (*FSMSnapshot) Persist ¶
func (f *FSMSnapshot) Persist(sink raft.SnapshotSink) error
Persist writes the FSMSnapshot data to the given SnapshotSink.
func (*FSMSnapshot) Release ¶
func (f *FSMSnapshot) Release()
type Node ¶
type Node struct { Fsm *FSM Logger zerolog.Logger Peers []config.RaftPeer // contains filtered or unexported fields }
Node represents a node in the Raft cluster.
func NewRaftNode ¶
NewRaftNode creates and initializes a new Raft node.
func (*Node) RemovePeer ¶
RemovePeer removes a peer from the Raft cluster.
func (*Node) Shutdown ¶
Shutdown gracefully stops the Node by stopping the gRPC server, closing RPC client connections, and shutting down the underlying Raft node. It returns an error if the Raft node fails to shutdown properly, ignoring the ErrRaftShutdown error which indicates the node was already shutdown.