common

package
v0.0.0-...-be95f36 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DialTimeout time.Duration = 900 * time.Millisecond
View Source
var NodeRefreshInterval float64
View Source
var NodesMap map[string]*RedisNode

Functions

This section is empty.

Types

type AddSlaveRequest

type AddSlaveRequest struct {
	Podname      string
	SlaveAddress string
	SlavePort    int
	SlaveAuth    string
}

type CloneRequest

type CloneRequest struct {
	Origin   string
	Clone    string
	Role     string
	Reconfig bool
	Promote  bool
}

type FailoverRequest

type FailoverRequest struct {
	Podname   string
	ReturnNew bool
}

type MonitorRequest

type MonitorRequest struct {
	Podname       string
	MasterAddress string
	AuthToken     string
	MasterPort    int
	Quorum        int
}

type NodeManager

type NodeManager interface {
	GetNodes() []*RedisNode
	GetNode(string) *RedisNode
	GetFreeNodes() []*RedisNode
	GetNodesInError() []*RedisNode
	LoadNodes() bool
	HasNodesInErrorState() bool
	NodeCount() int
	ErrorNodeCount() int
	FreeNodeCount() int
	HasFreeNodes() bool
	AddNode(*RedisNode)
}

type NodeStore

type NodeStore struct {
	Name         string
	Type         string
	Nodes        []*RedisNode
	NodesMap     map[string]*RedisNode
	NodesInError []*RedisNode
	FreeNodes    []*RedisNode
}

func (*NodeStore) AddNode

func (nm *NodeStore) AddNode(node *RedisNode)

func (*NodeStore) ErrorNodeCount

func (nm *NodeStore) ErrorNodeCount() (count int)

func (*NodeStore) FreeNodeCount

func (nm *NodeStore) FreeNodeCount() int

func (*NodeStore) GetFreeNodes

func (nm *NodeStore) GetFreeNodes() (nodes []*RedisNode)

func (*NodeStore) GetNode

func (nm *NodeStore) GetNode(name string) (node *RedisNode)

func (*NodeStore) GetNodes

func (nm *NodeStore) GetNodes() (nodes []*RedisNode)

func (*NodeStore) GetNodesInError

func (nm *NodeStore) GetNodesInError() (nodes []*RedisNode)

func (*NodeStore) HasFreeNodes

func (nm *NodeStore) HasFreeNodes() bool

func (*NodeStore) HasNodesInErrorState

func (nm *NodeStore) HasNodesInErrorState() bool

func (*NodeStore) LoadNodes

func (nm *NodeStore) LoadNodes() bool

func (*NodeStore) NodeCount

func (nm *NodeStore) NodeCount() int

type RedisNode

type RedisNode struct {
	Name                      string
	Address                   string
	Port                      int
	MaxMemory                 int
	LastStart                 time.Time
	Info                      structures.RedisInfoAll
	Slaves                    []*RedisNode
	AOFEnabled                bool
	SaveEnabled               bool
	PercentUsed               float64
	MemoryUseWarn             bool
	MemoryUseCritical         bool
	HasEnoughMemoryForMaster  bool
	Auth                      string
	LastUpdate                time.Time
	LastUpdateValid           bool
	LastUpdateDelay           time.Duration
	HasValidAuth              bool
	Connected                 bool
	LatencyHistory            client.LatencyHistory
	LatencyHistoryFastCommand client.LatencyHistory
	LatencyThreshold          int
	LatencyDoctor             string
	LatencyMonitoringEnabled  bool
	SlowLogThreshold          int64
	SlowLogLength             int64
	SlowLogRecords            []*client.SlowLog
}

func LoadNodeFromHostPort

func LoadNodeFromHostPort(ip string, port int, authtoken string) (node *RedisNode, err error)

func (*RedisNode) InErrorState

func (n *RedisNode) InErrorState() bool

func (*RedisNode) IsFree

func (n *RedisNode) IsFree() bool

func (*RedisNode) IsPromotable

func (n *RedisNode) IsPromotable() bool

func (*RedisNode) MaxMemoryHuman

func (n *RedisNode) MaxMemoryHuman() string

func (*RedisNode) Ping

func (n *RedisNode) Ping() bool

func (*RedisNode) UpdateData

func (n *RedisNode) UpdateData() (bool, error)

UpdateData will check if an update is needed, and update if so. It returns a boolean indicating if an update was done and an err.

func (*RedisNode) UptimeHuman

func (n *RedisNode) UptimeHuman() string

type RedisPod

type RedisPod struct {
	Name                  string
	Info                  structures.MasterInfo
	Slaves                []structures.InfoSlaves
	Master                *RedisNode
	SentinelCount         int
	ActiveSentinelCount   int
	ReportedSentinelCount int
	AuthToken             string
	ValidAuth             bool
	ValidMasterConnection bool
	NeededSentinels       int
	MissingSentinels      bool
	TooManySentinels      bool
	HasInfo               bool
	NeedsReset            bool
	HasValidSlaves        bool
}

func (*RedisPod) CanFailover

func (rp *RedisPod) CanFailover() bool

CanFailover tests failover conditions to determine if a failover call would succeed

func (*RedisPod) HasErrors

func (rp *RedisPod) HasErrors() bool

HasErrors checks various error conditions and returns t/f TODO: Some of these are better categorized as warnings and this should be split into a pair of functions: one for errors and one for warning. This will require additional work to incorporate the HasWarnings concept through the system.

func (*RedisPod) HasQuorum

func (rp *RedisPod) HasQuorum() bool

HasQuorum checks to see if the pod has Quorum.

func (*RedisPod) SlavesHaveEnoughMemory

func (rp *RedisPod) SlavesHaveEnoughMemory() bool

SlavesHaveEnoughMemory checks all slaves for their maximum memory to validate they match or beter the master

Jump to

Keyboard shortcuts

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