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 ¶
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.
Click to show internal directories.
Click to hide internal directories.