Documentation ¶
Index ¶
- Variables
- type Cluster
- func (c *Cluster) AddMember(member *Member) error
- func (c *Cluster) CanRemoveMember(from uint64, id uint64) bool
- func (c *Cluster) Clear()
- func (c *Cluster) GetMember(id uint64) *Member
- func (c *Cluster) IsIDRemoved(id uint64) bool
- func (c *Cluster) Members() map[uint64]*Member
- func (c *Cluster) RemoveMember(id uint64) error
- func (c *Cluster) Removed() []uint64
- func (c *Cluster) ReplaceMemberConnection(id uint64, newConn *Member) error
- func (c *Cluster) ValidateConfigurationChange(cc raftpb.ConfChange) error
- type Member
Constants ¶
This section is empty.
Variables ¶
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) CanRemoveMember ¶
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) IsIDRemoved ¶
IsIDRemoved checks if a Member is in the remove set.
func (*Cluster) RemoveMember ¶
RemoveMember removes a node from the Cluster Memberlist.
func (*Cluster) ReplaceMemberConnection ¶
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