etcd: github.com/etcd-io/etcd/raft/quorum Index | Files

package quorum

import "github.com/etcd-io/etcd/raft/quorum"

Index

Package Files

joint.go majority.go quorum.go voteresult_string.go

type AckedIndexer Uses

type AckedIndexer interface {
    AckedIndex(voterID uint64) (idx Index, found bool)
}

AckedIndexer allows looking up a commit index for a given ID of a voter from a corresponding MajorityConfig.

type Index Uses

type Index uint64

Index is a Raft log position.

func (Index) String Uses

func (i Index) String() string

type JointConfig Uses

type JointConfig [2]MajorityConfig

JointConfig is a configuration of two groups of (possibly overlapping) majority configurations. Decisions require the support of both majorities.

func (JointConfig) CommittedIndex Uses

func (c JointConfig) CommittedIndex(l AckedIndexer) Index

CommittedIndex returns the largest committed index for the given joint quorum. An index is jointly committed if it is committed in both constituent majorities.

func (JointConfig) Describe Uses

func (c JointConfig) Describe(l AckedIndexer) string

Describe returns a (multi-line) representation of the commit indexes for the given lookuper.

func (JointConfig) IDs Uses

func (c JointConfig) IDs() map[uint64]struct{}

IDs returns a newly initialized map representing the set of voters present in the joint configuration.

func (JointConfig) String Uses

func (c JointConfig) String() string

func (JointConfig) VoteResult Uses

func (c JointConfig) VoteResult(votes map[uint64]bool) VoteResult

VoteResult takes a mapping of voters to yes/no (true/false) votes and returns a result indicating whether the vote is pending, lost, or won. A joint quorum requires both majority quorums to vote in favor.

type MajorityConfig Uses

type MajorityConfig map[uint64]struct{}

MajorityConfig is a set of IDs that uses majority quorums to make decisions.

func (MajorityConfig) CommittedIndex Uses

func (c MajorityConfig) CommittedIndex(l AckedIndexer) Index

CommittedIndex computes the committed index from those supplied via the provided AckedIndexer (for the active config).

func (MajorityConfig) Describe Uses

func (c MajorityConfig) Describe(l AckedIndexer) string

Describe returns a (multi-line) representation of the commit indexes for the given lookuper.

func (MajorityConfig) Slice Uses

func (c MajorityConfig) Slice() []uint64

Slice returns the MajorityConfig as a sorted slice.

func (MajorityConfig) String Uses

func (c MajorityConfig) String() string

func (MajorityConfig) VoteResult Uses

func (c MajorityConfig) VoteResult(votes map[uint64]bool) VoteResult

VoteResult takes a mapping of voters to yes/no (true/false) votes and returns a result indicating whether the vote is pending (i.e. neither a quorum of yes/no has been reached), won (a quorum of yes has been reached), or lost (a quorum of no has been reached).

type VoteResult Uses

type VoteResult uint8

VoteResult indicates the outcome of a vote.

go:generate stringer -type=VoteResult

const (
    // VotePending indicates that the decision of the vote depends on future
    // votes, i.e. neither "yes" or "no" has reached quorum yet.
    VotePending VoteResult = 1 + iota
    // VoteLost indicates that the quorum has voted "no".
    VoteLost
    // VoteWon indicates that the quorum has voted "yes".
    VoteWon
)

func (VoteResult) String Uses

func (i VoteResult) String() string

Package quorum imports 5 packages (graph). Updated 2019-08-20. Refresh now. Tools for package owners.