membership

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 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) []byte

Types

type MemberMetadata

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

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
	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, dialer func(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error), recorder Recorder, 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