membership

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MPL-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPeerNotFound indicates that the requested peer does not exist in the pool.
	ErrPeerNotFound = errors.New("peer not found")
	// ErrPeerDisabled indicates that the requested peer has recently failed healthchecks.
	ErrPeerDisabled = errors.New("peer disabled by healthchecks")
)
View Source
var (
	ErrExistingClusterFound = errors.New("existing cluster found")
)

Functions

func EncodeMD

func EncodeMD(id uint64, clusterName string, rpcAddress string, version string) []byte

Types

type MemberMetadata

type MemberMetadata struct {
	RPCAddress  string `json:"raft_address"`
	ID          uint64 `json:"id"`
	ClusterName string `json:"cluster_id"`
	Version     string `json:"version"`
}

func DecodeMD

func DecodeMD(buf []byte) (MemberMetadata, error)

type MemberlistMemberProvider

type MemberlistMemberProvider interface {
	Members() []api.RaftContext
}

type Pool

type Pool interface {
	Call(id uint64, f func(*grpc.ClientConn) error) error
	UpdateMetadata(meta []byte)
	NodeMeta(limit int) []byte
	Join(hosts []string) error
	Members() []*api.Member
	MemberCount() int
	GossipMembers() []*memberlist.Node
	Shutdown() error
	WaitForNodes(ctx context.Context, clusterName, nodeName string, expectedNumber int, rpcDialer func(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)) ([]raft.Peer, error)
}

Pool builds a group of nodes. It handles new nodes discovery, failed nodes evinction and node's metadata updates propagations.

func New

func New(id uint64, clusterName string, port int, advertiseAddr string, advertisePort, rpcPort int, wanMode bool, dialer func(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error), recorder Recorder, stateDelegate memberlist.Delegate, eventDelegate Recorder, version string, logger *zap.Logger) Pool

New creates a new membership pool.

type Recorder

type Recorder interface {
	NotifyGossipJoin(id uint64)
	NotifyGossipLeave(id uint64)
}

Recorder records membership changes

Jump to

Keyboard shortcuts

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