membership

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2016 License: Apache-2.0 Imports: 6 Imported by: 83

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")
)

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// 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) CanRemoveMember

func (c *Cluster) CanRemoveMember(from uint64, id uint64) bool

CanRemoveMember checks if removing a Member would not result in a loss of quorum, this check is needed before submitting a configuration change that might block or harm the Cluster on Member recovery

func (*Cluster) Clear

func (c *Cluster) Clear()

Clear resets the list of active Members and removed Members.

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.

func (*Cluster) Removed

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

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

func (*Cluster) ReplaceMemberConnection

func (c *Cluster) ReplaceMemberConnection(id uint64, newConn *Member) error

ReplaceMemberConnection replaces the member's GRPC connection and GRPC client.

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

	api.RaftClient
	Conn *grpc.ClientConn
}

Member represents a raft Cluster Member

Jump to

Keyboard shortcuts

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