Documentation ¶
Index ¶
- type Consensus
- func (c *Consensus) ClusterState() (*model.ClusterState, error)
- func (c *Consensus) CurrentState() model.NodeState
- func (c *Consensus) HandleRequest(request *model.Request, response *model.Response) error
- func (c *Consensus) HeartBeat(args *model.HeartBeatRequest, reply *model.HeartBeatResponse) error
- func (c *Consensus) IsLeader() bool
- func (c *Consensus) Leader() (*model.ElectNode, error)
- func (c *Consensus) RequestVote(args *model.RequestVoteRequest, reply *model.RequestVoteResponse) error
- func (c *Consensus) Run() (<-chan model.StateTransition, error)
- func (c *Consensus) State(reply *model.NodeWithState) error
- func (c *Consensus) Visualize() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consensus ¶
type Consensus struct {
// contains filtered or unexported fields
}
func NewConsensus ¶
func (*Consensus) ClusterState ¶
func (c *Consensus) ClusterState() (*model.ClusterState, error)
ClusterState retrieves the current state of the cluster including all nodes.
func (*Consensus) CurrentState ¶
CurrentState returns the current election node state.
func (*Consensus) HandleRequest ¶ added in v1.0.4
func (*Consensus) HeartBeat ¶ added in v1.0.4
func (c *Consensus) HeartBeat(args *model.HeartBeatRequest, reply *model.HeartBeatResponse) error
HeartBeat handles heartbeat request from peer node
func (*Consensus) Leader ¶
Leader retrieves the current leader node from the cluster. It returns an error if no leader is found or there's an issue fetching the cluster state.
func (*Consensus) RequestVote ¶ added in v1.0.4
func (c *Consensus) RequestVote(args *model.RequestVoteRequest, reply *model.RequestVoteResponse) error
RequestVote handle vote request from peer node
func (*Consensus) Run ¶
func (c *Consensus) Run() (<-chan model.StateTransition, error)
Run starts the consensus Returns a channel of state transitions and an error
Click to show internal directories.
Click to hide internal directories.