membership

package
v0.0.0-...-967c829 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIDExists is thrown when a node wants to join the existing cluster but its ID already exists
	ErrIDExists = errors.New("membership: can't add node to cluster, node id is a duplicate")
	// ErrIDRemoved is thrown when a node tries to perform an operation on an existing cluster but was removed
	ErrIDRemoved = errors.New("membership: node was removed during cluster lifetime")
	// ErrIDNotFound is thrown when we try an operation on a member that does not exist in the cluster list
	ErrIDNotFound = errors.New("membership: member not found in cluster list")
	// ErrConfigChangeInvalid is thrown when a configuration change we received looks invalid in form
	ErrConfigChangeInvalid = errors.New("membership: ConfChange type should be either AddNode, RemoveNode or UpdateNode")
	// ErrCannotUnmarshalConfig is thrown when a node cannot unmarshal a configuration change
	ErrCannotUnmarshalConfig = errors.New("membership: cannot unmarshal configuration change")
	// ErrMemberRemoved is thrown when a node was removed from the cluster
	ErrMemberRemoved = errors.New("raft: member was removed from the cluster")
)

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	PeersBroadcast *watch.Queue
	// contains filtered or unexported fields
}

Cluster represents a set of active raft Members

func NewCluster

func NewCluster() *Cluster

NewCluster creates a new Cluster neighbors list for a raft Member.

func (*Cluster) AddMember

func (c *Cluster) AddMember(member *Member) error

AddMember adds a node to the Cluster Memberlist.

func (*Cluster) Clear

func (c *Cluster) Clear()

Clear resets the list of active Members and removed Members.

func (*Cluster) ClearMember

func (c *Cluster) ClearMember(id uint64) error

ClearMember removes a node from the Cluster Memberlist, but does NOT add it to the removed list.

func (*Cluster) GetMember

func (c *Cluster) GetMember(id uint64) *Member

GetMember returns informations on a given Member.

func (*Cluster) IsIDRemoved

func (c *Cluster) IsIDRemoved(id uint64) bool

IsIDRemoved checks if a Member is in the remove set.

func (*Cluster) Members

func (c *Cluster) Members() map[uint64]*Member

Members returns the list of raft Members in the Cluster.

func (*Cluster) RemoveMember

func (c *Cluster) RemoveMember(id uint64) error

RemoveMember removes a node from the Cluster Memberlist, and adds it to the removed list.

func (*Cluster) Removed

func (c *Cluster) Removed() []uint64

Removed returns the list of raft Members removed from the Cluster.

func (*Cluster) UpdateMember

func (c *Cluster) UpdateMember(id uint64, m *api.RaftMember) error

UpdateMember updates member address.

func (*Cluster) ValidateConfigurationChange

func (c *Cluster) ValidateConfigurationChange(cc raftpb.ConfChange) error

ValidateConfigurationChange takes a proposed ConfChange and ensures that it is valid.

type Member

type Member struct {
	*api.RaftMember
}

Member represents a raft Cluster Member

Jump to

Keyboard shortcuts

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