clustering

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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)
	UpdateNoStart(types.NamespacedName)
	Stop(types.NamespacedName)
	StopAll()
}

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