clustering

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultLogger added in v0.15.0

func SetDefaultLogger(log logr.Logger)

SetDefaultLogger sets the default logger used by the clustering package. The default logger is not normally used. It is used when another logger is not set in context due to testing or programming errors.

Types

type AgentConn

type AgentConn interface {
	agent.AgentClient
	io.Closer
}

AgentConn represents a gRPC connection to a moco-agent

type AgentFactory

type AgentFactory interface {
	New(ctx context.Context, cluster *mocov1beta2.MySQLCluster, index int) (AgentConn, error)
}

AgentFactory represents the interface of a factory to create AgentConn

func NewAgentFactory

func NewAgentFactory(r dbop.Resolver, reloader *cert.Reloader) AgentFactory

NewAgentFactory returns a new AgentFactory.

type ClusterManager

type ClusterManager interface {
	Update(types.NamespacedName, string)
	UpdateNoStart(types.NamespacedName, string)
	Stop(types.NamespacedName)
	StopAll()
	Pause(types.NamespacedName)
}

ClusterManager represents the interface to manage goroutines to maintain MySQL clusters.

A goroutine for a MySQLCluster is started when `Update` method is called for the first time, and stops when `Stop` is called. Internally, context.Context is used to stop the goroutine.

This interface is meant to be used by MySQLClusterReconciler.

func NewClusterManager

func NewClusterManager(interval time.Duration, m manager.Manager, opf dbop.OperatorFactory, af AgentFactory, log logr.Logger) ClusterManager

type ClusterState

type ClusterState int

ClusterState represents the state of a MySQL cluster. Consult docs/clustering.md for details.

const (
	StateUndecided ClusterState = iota
	StateIncomplete
	StateHealthy
	StateCloning
	StateRestoring
	StateDegraded
	StateFailed
	StateLost
)

List of possible ClusterState.

func (ClusterState) String

func (s ClusterState) String() string

String returns a unique string for each ClusterState.

type StatusSet

type StatusSet struct {
	Primary      int
	Cluster      *mocov1beta2.MySQLCluster
	Password     *password.MySQLPassword
	Pods         []*corev1.Pod
	DBOps        []dbop.Operator
	MySQLStatus  []*dbop.MySQLInstanceStatus
	ExecutedGTID string
	Errants      []int
	Candidates   []int

	NeedSwitch bool
	Candidate  int
	State      ClusterState
}

StatusSet represents the set of information to determine the ClusterState and later operations.

func (*StatusSet) Close

func (ss *StatusSet) Close()

Close closes `ss.DBOps`.

func (*StatusSet) DecideState

func (ss *StatusSet) DecideState()

DecideState decides the ClusterState and set it to `ss.State`. It may also set `ss.NeedSwitch` and `ss.Candidate` for switchover.

Jump to

Keyboard shortcuts

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