state

package
v0.0.0-...-c8a1e77 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consul

type Consul struct {
	Ready      bool
	Healthy    bool
	Master     bool
	MasterAddr string
	MasterPort int
	Stopped    bool
}

Consul state used by the reconciler to decide what actions to take

func (*Consul) IsMaster

func (c *Consul) IsMaster() bool

isConsulMaster return whether the Consul lock is held or not if it's held, the Redis under management should become master

func (*Consul) IsSlave

func (c *Consul) IsSlave() bool

isConsulSlave return whether the Consul lock is held or not if its *not* hold, the Reids under management should become slave

func (*Consul) IsUnhealhy

func (c *Consul) IsUnhealhy() bool

func (*Consul) NoMasterElected

func (c *Consul) NoMasterElected() bool

NoMasterElected return whether any Consul elected Redis master exist

type Redis

type Redis struct {
	Healthy    bool        // are we able to connect to Redis?
	Ready      bool        // are we ready to provide state for the reconciler?
	Info       RedisStatus // parse "info" data
	InfoString string      `testdiff:"ignore"` // raw "info" data
	Stopped    bool
}

Redis state represent the full state of the connection with Redis

func (*Redis) IsRedisMaster

func (r *Redis) IsRedisMaster() bool

isRedisMaster return whether the Redis under management currently see itself as a master instance or not

func (*Redis) IsUnhealthy

func (r *Redis) IsUnhealthy() bool

type RedisStatus

type RedisStatus struct {
	Role                 string        // current redis role (master or slave)
	Loading              bool          // is redis currently loading data from disk?
	MasterLinkUp         bool          // is the link to master up (master_link_status == up)
	MasterLinkDownSince  time.Duration // for how long has the master link been down?
	MasterSyncInProgress bool          // is a master sync in progress?
	MasterHost           string        // if slave, the master hostname its replicating from
	MasterPort           int           // if slave, the master port its replicating from
}

func (*RedisStatus) Changed

func (r *RedisStatus) Changed(new RedisStatus) bool

changed will test if the current replication state is different from the new one passed in as argument

Jump to

Keyboard shortcuts

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