myctl

package
v0.0.0-...-b49765e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Timeout5s     = 5 * time.Second
	Timeout15s    = 15 * time.Second
	SwitchCount   = 2
	MyctlReplicas = 1
)

Variables

This section is empty.

Functions

func EqStrings

func EqStrings(a, b []string) bool

func SwitchPrimary

func SwitchPrimary(ctx context.Context, mysql *v1.Mysql, id int) error

func SwitchPrimaryAll

func SwitchPrimaryAll(mysql *v1.Mysql) map[int]error

Types

type Myctl

type Myctl struct {
	sync.Mutex

	C chan event.GenericEvent
	M map[types.NamespacedName]*MysqlGroup

	ReadinessProbe bool
	LivenessProbe  bool
	StartupProbe   bool
}

func NewMyctl

func NewMyctl() *Myctl

func (*Myctl) GetOrNewGroup

func (ctl *Myctl) GetOrNewGroup(mysql *v1.Mysql) (*MysqlGroup, error)

func (*Myctl) PullMysqlGroup

func (ctl *Myctl) PullMysqlGroup(ctx *tiny.Context) *MysqlGroup

func (*Myctl) Purge

func (ctl *Myctl) Purge(k types.NamespacedName) error

func (*Myctl) PushMysqlGroup

func (ctl *Myctl) PushMysqlGroup(ctx *tiny.Context)

func (*Myctl) Route

func (ctl *Myctl) Route(r *tiny.Router)

func (*Myctl) Run

func (ctl *Myctl) Run()

func (*Myctl) SyncSpec

func (ctl *Myctl) SyncSpec(mysql *v1.Mysql) error

func (*Myctl) SyncStatus

func (ctl *Myctl) SyncStatus(mysql *v1.Mysql) error

type MysqlGroup

type MysqlGroup struct {
	*Myctl
	*v1.Mysql
	States      map[mylet.StateKey]*mylet.MysqlState
	SwitchCount int
	SwitchTime  time.Time
	Running     bool
	ExitChan    chan struct{}
}

func (*MysqlGroup) Check

func (g *MysqlGroup) Check() error

func (*MysqlGroup) Color

func (g *MysqlGroup) Color(id int) (red, yellow, green int)

func (*MysqlGroup) Diff

func (g *MysqlGroup) Diff(mysql *v1.Mysql) error

func (*MysqlGroup) Start

func (g *MysqlGroup) Start()

func (*MysqlGroup) SwitchPrimary

func (g *MysqlGroup) SwitchPrimary(newId int) error

Jump to

Keyboard shortcuts

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