member

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RetryPeriod is the peroid after which an operation is retried
	RetryPeriod = 2 * time.Second

	// RetrySteps is the no. of steps for exponential backoff.
	RetrySteps = 4

	// EtcdTimeout is timeout for etcd operations
	EtcdTimeout = 5 * time.Second
)

Variables

View Source
var (
	// ErrMissingMember is a sentient error to describe a case of a member being missing from the member list
	ErrMissingMember = errors.New("member missing from member list")
)

Functions

func AddLearnerWithRetry

func AddLearnerWithRetry(ctx context.Context, m Control, retrySteps int, dataDir string) error

AddLearnerWithRetry add a new member as a learner with exponential backoff.

Types

type Control

type Control interface {
	// AddMemberAsLearner add a new member as a learner to the etcd cluster
	AddMemberAsLearner(context.Context) error

	// IsClusterScaledUp determines whether a etcd cluster is getting scale-up or not.
	IsClusterScaledUp(context.Context, client.Client) (bool, error)

	// IsMemberInCluster checks is the current members peer URL is already part of the etcd cluster.
	IsMemberInCluster(context.Context) (bool, error)

	// WasMemberInCluster checks whether current members was part of the etcd cluster or not.
	WasMemberInCluster(context.Context, client.Client) bool

	// PromoteMember promotes an etcd member from a learner to a voting member of the cluster.
	// This will succeed if and only if learner is in a healthy state and the learner is in sync with leader.
	PromoteMember(context.Context) error

	// UpdateMemberPeerURL updates the peer address of a specified etcd cluster member.
	UpdateMemberPeerURL(context.Context, etcdClient.ClusterCloser) error

	// RemoveMember removes the member from the etcd cluster.
	RemoveMember(context.Context) error

	// IsLearnerPresent checks for the learner(non-voting) member in a cluster.
	IsLearnerPresent(context.Context) (bool, error)

	// GetPeerURLs returns the list of current peer URLs of the etcd cluster member.
	GetPeerURLs(context.Context, etcdClient.ClusterCloser) ([]string, error)
}

Control interface defines the functionalities needed to manipulate a member in the etcd cluster

func NewMemberControl

func NewMemberControl(etcdConnConfig *brtypes.EtcdConnectionConfig) Control

NewMemberControl returns new ExponentialBackoff.

Jump to

Keyboard shortcuts

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