Versions in this module Expand all Collapse all v0 v0.1.2 Jan 10, 2024 Changes in this version + const ClusterReasonReplicaNOK + const ClusterReasonScaling + const ClusterStateNOK + const ClusterStateOK + const ClusterStateUnknown + const ClusterStatusFail + const ClusterStatusMigrating + const ClusterStatusNotRetrived + const ReplicaStatusMasterNil + const ReplicaStatusNOK + const ReplicaStatusReady + const ReplicaStatusSyncing + const ReplicaStatusUnknown + func CheckandUpdateClusterState(cinfos *ClusterInfos, cs clusterstate, fromip string, nip string, ...) error type Admin + func (a *Admin) FailoverSlaveToMaster(ctx context.Context, slave *Node, option RedisFailover) error + func (a *Admin) GetSlaveStatus(ip string, ctx context.Context) (string, error) type ClusterInfos + ClusterNokReason map[string]string + ClusterState clusterstate type IAdmin + FailoverSlaveToMaster func(ctx context.Context, slave *Node, option RedisFailover) error + type RedisFailover string + const RedisFailoverDefault + const RedisFailoverForce + const RedisFailoverTakeover + type RedisReplStatus string + const RedisLinkUp + const RedisMasterSillPending + const RedisSyncing v0.1.1 Dec 7, 2023 v0.1.0 Dec 7, 2023 Changes in this version + const ClusterInfosConsistent + const ClusterInfosInconsistent + const ClusterInfosPartial + const ClusterInfosUnset + const DefaultHashMaxSlots + const DefaultRedisPort + const ErrNotFound + const NodeStatusFail + const NodeStatusHandshake + const NodeStatusNoAddr + const NodeStatusNoFlags + const NodeStatusPFail + const RedisLinkStateConnected + const RedisLinkStateDisconnected + const RedisMasterRole + const RedisSlaveRole + const ResetHard + const ResetSoft + var IsMasterWithNoSlot = func(n *Node) bool + var IsMasterWithSlot = func(n *Node) bool + var IsSlave = func(n *Node) bool + func Contains(s []Slot, e Slot) bool + func DecodeNodeStartTime(input *string, log logr.Logger) (time.Time, error) + func DecodeSlotRange(str string) ([]Slot, *ImportingSlot, *MigratingSlot, error) + func IsInconsistentError(err error) bool + func IsNodeNotFoundedError(err error) bool + func IsPartialError(err error) bool + func LessByID(n1, n2 *Node) bool + func MoreByID(n1, n2 *Node) bool + func NewClient(ctx context.Context, addr string, password string, cnxTimeout time.Duration, ...) (*redis.Client, error) + type Admin struct + func (a *Admin) AddSlots(ctx context.Context, addr string, slots []Slot) error + func (a *Admin) AttachNodeToCluster(ctx context.Context, addr string) error + func (a *Admin) AttachSlaveToMaster(ctx context.Context, slave *Node, masterID string) error + func (a *Admin) Close(ctx context.Context) + func (a *Admin) ClusterManagerNodeIsEmpty(ctx context.Context) (bool, error) + func (a *Admin) Connections() IAdminConnections + func (a *Admin) DetachSlave(ctx context.Context, slave *Node) error + func (a *Admin) FlushAndReset(ctx context.Context, addr string, mode string) error + func (a *Admin) ForgetNode(ctx context.Context, id string) error + func (a *Admin) GetAllConfig(ctx context.Context, c *redis.Client, addr string) (map[string]string, error) + func (a *Admin) GetClusterInfos(ctx context.Context) (*ClusterInfos, error) + func (a *Admin) GetHashMaxSlot() Slot + func (a *Admin) MigrateKeys(ctx context.Context, addr string, dest *Node, slots []Slot, batch int, ...) (int, error) + func (a *Admin) MigrateKeysInSlot(ctx context.Context, addr string, dest *Node, slot Slot, batch int, ...) (int, error) + func (a *Admin) ResetPassword(ctx context.Context, newPassword string) error + func (a *Admin) SetConfigEpoch(ctx context.Context) error + func (a *Admin) SetConfigIfNeed(ctx context.Context, newConfig map[string]string) error + func (a *Admin) SetSlot(ctx context.Context, addr, action string, slot Slot, nodeID string) error + func (a *Admin) SetSlots(ctx context.Context, addr, action string, slots []Slot, nodeID string) error + type AdminConnections struct + func (cnx *AdminConnections) Add(ctx context.Context, addr string) error + func (cnx *AdminConnections) AddAll(ctx context.Context, addrs []string) + func (cnx *AdminConnections) Close(ctx context.Context) + func (cnx *AdminConnections) Get(ctx context.Context, addr string) (*redis.Client, error) + func (cnx *AdminConnections) GetAUTH() (string, bool) + func (cnx *AdminConnections) GetAll() map[string]*redis.Client + func (cnx *AdminConnections) GetDifferentFrom(addr string) (*redis.Client, error) + func (cnx *AdminConnections) GetRandom() (*redis.Client, error) + func (cnx *AdminConnections) GetSelected(addrs []string) map[string]*redis.Client + func (cnx *AdminConnections) Reconnect(ctx context.Context, addr string) error + func (cnx *AdminConnections) Remove(ctx context.Context, addr string) + func (cnx *AdminConnections) ReplaceAll(ctx context.Context, addrs []string) + func (cnx *AdminConnections) Reset(ctx context.Context) + func (cnx *AdminConnections) Update(ctx context.Context, addr string) (*redis.Client, error) + func (cnx *AdminConnections) ValidatePipeResp(ctx context.Context, resp []redis.Cmder, addr string, err error, ...) bool + func (cnx *AdminConnections) ValidateResp(ctx context.Context, resp *redis.Cmd, addr, errMessage string) error + type AdminOptions struct + ClientName string + ConnectionTimeout time.Duration + Password string + RenameCommandsFile string + type Cluster struct + ActionsInfo ClusterActionsInfo + HaStatus redisv1alpha1.HaStatus + Name string + Namespace string + Nodes map[string]*Node + NodesPlacement redisv1alpha1.NodesPlacementInfo + Status redisv1alpha1.ClusterStatus + func NewCluster(name, namespace string) *Cluster + func (c *Cluster) AddNode(node *Node) + func (c *Cluster) GetNodeByFunc(f FindNodeFunc) (*Node, error) + func (c *Cluster) GetNodeByID(id string) (*Node, error) + func (c *Cluster) GetNodeByIP(ip string) (*Node, error) + func (c *Cluster) GetNodeByPodName(name string) (*Node, error) + func (c *Cluster) GetNodesByFunc(f FindNodeFunc) (Nodes, error) + type ClusterActionsInfo struct + NbslotsToMigrate int32 + type ClusterInfos struct + Infos map[string]*NodeInfos + Status string + func NewClusterInfos() *ClusterInfos + func (c *ClusterInfos) ComputeStatus(log logr.Logger) bool + func (c *ClusterInfos) GetNodes() Nodes + type ClusterInfosError struct + func NewClusterInfosError() ClusterInfosError + func (e ClusterInfosError) Error() string + func (e ClusterInfosError) Inconsistent() bool + func (e ClusterInfosError) Partial() bool + type ConfigSignature map[string]SlotSlice + func (c ConfigSignature) String() string + type CustomType int + type Error string + func (e Error) Error() string + type FindNodeFunc func(node *Node) bool + type IAdmin interface + AddSlots func(ctx context.Context, addr string, slots []Slot) error + AttachNodeToCluster func(ctx context.Context, addr string) error + AttachSlaveToMaster func(ctx context.Context, slave *Node, masterID string) error + Close func(ctx context.Context) + ClusterManagerNodeIsEmpty func(ctx context.Context) (bool, error) + Connections func() IAdminConnections + DetachSlave func(ctx context.Context, slave *Node) error + FlushAndReset func(ctx context.Context, addr string, mode string) error + ForgetNode func(ctx context.Context, id string) error + GetAllConfig func(ctx context.Context, c *redis.Client, addr string) (map[string]string, error) + GetClusterInfos func(ctx context.Context) (*ClusterInfos, error) + GetHashMaxSlot func() Slot + MigrateKeys func(ctx context.Context, addr string, dest *Node, slots []Slot, batch, timeout int, ...) (int, error) + MigrateKeysInSlot func(ctx context.Context, addr string, dest *Node, slot Slot, batch int, ...) (int, error) + ResetPassword func(ctx context.Context, newPassword string) error + SetConfigEpoch func(ctx context.Context) error + SetConfigIfNeed func(ctx context.Context, newConfig map[string]string) error + SetSlot func(ctx context.Context, addr string, action string, slot Slot, nodeID string) error + SetSlots func(ctx context.Context, addr string, action string, slots []Slot, nodeID string) error + func NewAdmin(addrs []string, options *AdminOptions, log logr.Logger, ctx context.Context) IAdmin + type IAdminConnections interface + Add func(ctx context.Context, addr string) error + AddAll func(ctx context.Context, addrs []string) + Get func(ctx context.Context, addr string) (*redis.Client, error) + GetAUTH func() (string, bool) + GetAll func() map[string]*redis.Client + GetDifferentFrom func(addr string) (*redis.Client, error) + GetRandom func() (*redis.Client, error) + GetSelected func(addrs []string) map[string]*redis.Client + Reconnect func(ctx context.Context, addr string) error + Remove func(ctx context.Context, addr string) + ReplaceAll func(ctx context.Context, addrs []string) + Reset func(ctx context.Context) + ValidatePipeResp func(ctx context.Context, resp []redis.Cmder, addr string, err error, ...) bool + ValidateResp func(ctx context.Context, resp *redis.Cmd, addr, errMessage string) error + func NewAdminConnections(addrs []string, options *AdminOptions, log logr.Logger, ctx context.Context) IAdminConnections + type ImportingSlot struct + FromNodeID string + SlotID Slot + func (s ImportingSlot) String() string + type MigratingSlot struct + SlotID Slot + ToNodeID string + func (s MigratingSlot) String() string + type Node struct + ConfigEpoch int64 + FailStatus []string + ID string + IP string + ImportingSlots map[Slot]string + LinkState string + MasterReferent string + MigratingSlots map[Slot]string + NodeName string + PingSent int64 + PodName string + PongRecv int64 + Port string + Role string + ServerStartTime time.Time + Slots []Slot + StatefulSet string + Zonename string + func NewDefaultNode() *Node + func NewNode(id, ip string, pod *corev1.Pod) *Node + func (n *Node) Balance() int + func (n *Node) Clear() + func (n *Node) GetRole() redisv1alpha1.RedisRole + func (n *Node) HasStatus(flag string) bool + func (n *Node) IPPort() string + func (n *Node) SetBalance(balance int) + func (n *Node) SetFailureStatus(flags string) + func (n *Node) SetLinkStatus(status string) error + func (n *Node) SetReferentMaster(ref string) + func (n *Node) SetRole(flags string) error + func (n *Node) String() string + func (n *Node) ToAPINode() redisv1alpha1.RedisClusterNode + func (n *Node) TotalSlots() int + type NodeInfos struct + Friends Nodes + Node *Node + func DecodeNodeInfos(input *string, addr string, log logr.Logger) *NodeInfos + func NewNodeInfos() *NodeInfos + type Nodes []*Node + func (n Nodes) CountByFunc(fn func(*Node) bool) (result int) + func (n Nodes) FilterByFunc(fn func(*Node) bool) Nodes + func (n Nodes) GetNodeByID(id string) (*Node, error) + func (n Nodes) GetNodesByFunc(f FindNodeFunc) (Nodes, error) + func (n Nodes) Len() int + func (n Nodes) Less(i, j int) bool + func (n Nodes) SortByFunc(less func(*Node, *Node) bool) Nodes + func (n Nodes) SortNodes() Nodes + func (n Nodes) String() string + func (n Nodes) Swap(i, j int) + type Slot uint64 + func AddSlots(slots []Slot, addedSlots []Slot) []Slot + func BuildSlotSlice(min, max Slot) []Slot + func DecodeSlot(s string) (Slot, error) + func RemoveSlot(slots []Slot, removedSlot Slot) []Slot + func RemoveSlots(slots []Slot, removedSlots []Slot) []Slot + func (s Slot) String() string + func (s Slot) ToInt() int + type SlotRange struct + Max Slot + Min Slot + func SlotRangesFromSlots(slots []Slot) []SlotRange + func (s SlotRange) String() string + func (s SlotRange) Total() int + type SlotSlice []Slot + func (s SlotSlice) Len() int + func (s SlotSlice) Less(i, j int) bool + func (s SlotSlice) String() string + func (s SlotSlice) Swap(i, j int)