peer

package
v0.0.0-...-7464013 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Epoch     config.TestEpoch
	ID        uint64
	Peers     []raft.Peer
	SelfAddr  string
	PeerAddrs map[uint64]string
}

Config contains configurations for constructing a Peer.

type Peer

type Peer struct {
	// contains filtered or unexported fields
}

Peer is a member of a Raft consensus group. Its primary roles are to: 1. route incoming Raft messages 2. periodically tick the Raft RawNode 3. serve as a scheduler for Raft proposal pipeline events

func New

New creates a new Peer.

func (*Peer) Campaign

func (p *Peer) Campaign()

Campaign causes the Peer to transition to the candidate state and attempt to acquire Raft leadership.

func (*Peer) HandleMessage

func (p *Peer) HandleMessage(m *transpb.RaftMsg)

HandleMessage implements transport.RaftHandler.

func (*Peer) Propose

func (p *Peer) Propose(prop proposal.Proposal) bool

Propose proposes the provided update to the Raft state machine.

func (*Peer) ProposeWith

func (p *Peer) ProposeWith(enc proposal.EncProposal, c chan bool) bool

ProposeWith proposes the provided encoded update to the Raft state machine. Channel c is expected to have a capacity of 1.

func (*Peer) Run

func (p *Peer) Run()

Run starts the Peer's processing loop.

func (*Peer) Stop

func (p *Peer) Stop()

Stop stops all processing and releases all resources held by Peer.

func (*Peer) WaitForAllCaughtUp

func (p *Peer) WaitForAllCaughtUp()

WaitForAllCaughtUp waits for all peers to catch up to the same log index.

Jump to

Keyboard shortcuts

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