consensus

package
v0.0.0-...-c03468e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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 NewConsensus(cfg *config.Config, logger log.Logger, node model.ElectNode) (*Consensus, error)

func (*Consensus) HeartBeat

func (c *Consensus) HeartBeat(args *model.HeartBeatRequest, reply *model.HeartBeatResponse) error

HeartBeat handles heartbeat request from peer node

func (*Consensus) Ping

func (c *Consensus) Ping(args struct{}, reply *string) error

Ping handles ping request from peer node

func (*Consensus) RequestVote

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

func (*Consensus) Visualize

func (c *Consensus) Visualize() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL