membership

package
v1.9.24 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPeerNotFound = errors.New("peer not found")
	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 Gossip

type Gossip struct {
	// contains filtered or unexported fields
}

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), logger *zap.Logger) *Gossip

func (*Gossip) Call

func (b *Gossip) Call(id uint64, f func(*grpc.ClientConn) error) error

func (*Gossip) GetBroadcasts

func (l *Gossip) GetBroadcasts(overhead, limit int) [][]byte

func (*Gossip) Join

func (m *Gossip) Join(hosts []string) error

func (*Gossip) LocalState

func (l *Gossip) LocalState(join bool) []byte

func (*Gossip) MemberCount

func (self *Gossip) MemberCount() int

func (*Gossip) Members

func (m *Gossip) Members() []*api.Member

func (*Gossip) MergeRemoteState

func (m *Gossip) MergeRemoteState(buf []byte, join bool)

func (*Gossip) NodeMeta

func (s *Gossip) NodeMeta(limit int) []byte

func (*Gossip) NotifyJoin

func (b *Gossip) NotifyJoin(n *memberlist.Node)

NotifyJoin is called if a peer joins the cluster.

func (*Gossip) NotifyLeave

func (b *Gossip) NotifyLeave(n *memberlist.Node)

NotifyLeave is called if a peer leaves the cluster.

func (*Gossip) NotifyMsg

func (l *Gossip) NotifyMsg(b []byte)

func (*Gossip) NotifyUpdate

func (b *Gossip) NotifyUpdate(n *memberlist.Node)

NotifyUpdate is called if a cluster peer gets updated.

func (*Gossip) Shutdown

func (self *Gossip) Shutdown() error

func (*Gossip) UpdateMetadata

func (self *Gossip) UpdateMetadata(meta []byte)

func (*Gossip) WaitForNodes

func (mesh *Gossip) WaitForNodes(ctx context.Context, clusterName, nodeName string, expectedNumber int, rpcDialer func(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)) ([]raft.Peer, error)

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 Peer

type Peer struct {
	Conn    *grpc.ClientConn
	Enabled bool
}

Jump to

Keyboard shortcuts

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