membership

package
v0.0.0-...-f6126b0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStaticPartitions

func NewStaticPartitions(memberCount int) [][]PartitionID

NewStaticPartitions naively assigns partitions to a static number of members. Useful when not using a dynamic means of assignment (testing, static clusters, etc.)

Types

type ClientSet

type ClientSet struct {
	ClientV3    *clientv3.Client
	KV          etcdserverpb.KVClient
	Lease       etcdserverpb.LeaseClient
	GRPC        *grpc.ClientConn
	WatchStatus *watch.Status
}

ClientSet holds various clients used to access etcd.

func NewClientSet

func NewClientSet(gc *GrpcContext, endpointURL string) (*ClientSet, error)

type CoordinatorClientSet

type CoordinatorClientSet struct {
	*ClientSet
	ClockReconstitutionLock *concurrency.Mutex
}

CoordinatorClientSet is ClientSet plus extra fields that only pertain to coordinator clusters.

func InitCoordinator

func InitCoordinator(gc *GrpcContext, endpointURL string) (*CoordinatorClientSet, error)

type GrpcContext

type GrpcContext struct {
	GrpcKeepaliveInterval time.Duration
	GrpcKeepaliveTimeout  time.Duration
	TLS                   *tls.Config
}

GrpcContext contains common values used to set up gRPC connections across the fleet of clusters.

func (*GrpcContext) LoadPKI

func (g *GrpcContext) LoadPKI(clientCert, clientKey, caCert string) error

type MemberID

type MemberID int64

MemberID is a monotonic ID. As members are added, this can only go up.

type PartitionID

type PartitionID int8

PartitionID references one of the partitions implied by partitionCount.

type Pool

type Pool struct {
	WatchMux *watch.Mux
	// contains filtered or unexported fields
}

Pool is a dynamic set of etcd clients, responsible for their entire lifecycle.

func NewPool

func NewPool(gc *GrpcContext, wm *watch.Mux) *Pool

func (*Pool) AddMember

func (p *Pool) AddMember(ctx context.Context, id MemberID, endpointURL string, partitions []PartitionID) error

func (*Pool) GetMemberForKey

func (p *Pool) GetMemberForKey(key string) *ClientSet

func (*Pool) IterateMembers

func (p *Pool) IterateMembers(ctx context.Context, fn func(context.Context, *ClientSet) error) error

Jump to

Keyboard shortcuts

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