Documentation ¶
Index ¶
- type Admin
- func (a *Admin) AddSlots(addr string, slots []redis.Slot) error
- func (a *Admin) AttachNodeToCluster(addr string) error
- func (a *Admin) AttachSlaveToMaster(slave *redis.Node, master *redis.Node) error
- func (a *Admin) Close()
- func (a *Admin) Connections() redis.AdminConnectionsInterface
- func (a *Admin) CountKeysInSlot(addr string, node redis.Slot) (int64, error)
- func (a *Admin) DelSlots(addr string, slots []redis.Slot) error
- func (a *Admin) DetachSlave(slave *redis.Node) error
- func (a *Admin) FlushAll()
- func (a *Admin) FlushAndReset(addr string, mode string) error
- func (a *Admin) ForgetNode(addr string) error
- func (a *Admin) ForgetNodeByAddr(addr string) error
- func (a *Admin) GetClusterInfos() (*redis.ClusterInfos, error)
- func (a *Admin) GetClusterInfosSelected(addr []string) (*redis.ClusterInfos, error)
- func (a *Admin) GetHashMaxSlot() redis.Slot
- func (a *Admin) GetKeysInSlot(addr string, node redis.Slot, batch int, limit bool) ([]string, error)
- func (a *Admin) InitRedisCluster(addr string) error
- func (a *Admin) MigrateKeys(addr string, dest *redis.Node, slots []redis.Slot, batch, timeout int, ...) (int, error)
- func (a *Admin) RebuildConnectionMap(addrs []string, options *redis.AdminOptions)
- func (a *Admin) SetSlots(addr, action string, slots []redis.Slot, nodeID string) error
- func (a *Admin) StartFailover(addr string) error
- type ClusterInfosRetType
- type Connections
- func (cnx *Connections) Add(addr string) error
- func (cnx *Connections) AddAll(addrs []string)
- func (cnx *Connections) Close()
- func (cnx *Connections) Get(addr string) (redis.ClientInterface, error)
- func (cnx *Connections) GetAll() map[string]redis.ClientInterface
- func (cnx *Connections) GetDifferentFrom(addr string) (redis.ClientInterface, error)
- func (cnx *Connections) GetRandom() (redis.ClientInterface, error)
- func (cnx *Connections) GetSelected(addrs []string) map[string]redis.ClientInterface
- func (cnx *Connections) Reconnect(addr string) error
- func (cnx *Connections) Remove(addr string)
- func (cnx *Connections) ReplaceAll(addrs []string)
- func (cnx *Connections) Reset()
- func (cnx *Connections) ValidatePipeResp(client redis.ClientInterface, addr, errMessage string) bool
- func (cnx *Connections) ValidateResp(resp *radix.Resp, addr, errMessage string) error
- type CountKeysInSlotRetType
- type GetClusterInfoRetType
- type GetKeysInSlotRetType
- type MigrateKeyRetType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct { // HashMaxSlots Max slot value HashMaxSlots redis.Slot // InitRedisClusterRet map of returned error for InitRedisCluster function InitRedisClusterRet map[string]error // GetClusterInfosRet returned value for GetClusterInfos function GetClusterInfosRet ClusterInfosRetType // GetClusterInfosSelectedRet returned value for GetClusterInfos function GetClusterInfosSelectedRet ClusterInfosRetType // AttachNodeToClusterRet map of returned error for AttachNodeToCluster function AttachNodeToClusterRet map[string]error // UpdateClientsRet map of returned error for UpdateClients function UpdateClientsRet map[string]error // StartFailoverRet map of returned error for StartFailover function StartFailoverRet map[string]error // ForgetNodeRet map of returned error for ForgetNode function ForgetNodeRet map[string]error // SetSlotsRet map of returned error for SetSlots function SetSlotsRet map[string]error // AddSlotsRet map of returned error for AddSlots function AddSlotsRet map[string]error // DelSlotsRet map of returned error for DellSlots function DelSlotsRet map[string]error // GetKeysInSlotRet map of returned data for GetKeysInSlot function GetKeysInSlotRet map[string]GetKeysInSlotRetType // CountKeysInSlotRet map of returned data for for CountKeysInSlot function CountKeysInSlotRet map[string]CountKeysInSlotRetType // MigrateKeysRet map of returned error for MigrateKeys function MigrateKeysRet map[string]MigrateKeyRetType // AttachSlaveToMasterRet map of returned error for AttachSlaveToMaster function AttachSlaveToMasterRet map[string]error // DetachSlaveToMasterRet map of returned error for DetachSlave function DetachSlaveToMasterRet map[string]error // ResetRet map of returned error for FlushAndReset function FlushAndResetRet map[string]error // contains filtered or unexported fields }
Admin representation of a fake redis admin, where all return error for fake admin commands are configurable per addr, and return nil by default
func NewFakeAdmin ¶
NewFakeAdmin returns new AdminInterface for fake admin
func (*Admin) AttachNodeToCluster ¶
AttachNodeToCluster command use to connect a Node to the cluster
func (*Admin) AttachSlaveToMaster ¶
AttachSlaveToMaster attach a slave to a master node
func (*Admin) Close ¶
func (a *Admin) Close()
Close used to close all possible resources instanciate by the Admin
func (*Admin) Connections ¶
func (a *Admin) Connections() redis.AdminConnectionsInterface
Connections returns a connection map
func (*Admin) CountKeysInSlot ¶
CountKeysInSlot exec the redis command to count the keys in the given slot of the node
func (*Admin) DetachSlave ¶
DetachSlave dettach a slave to its master
func (*Admin) FlushAndReset ¶
FlushAndReset reset the cluster configuration of the node, also flush in the same pipe
func (*Admin) ForgetNode ¶
ForgetNode used to force other redis cluster node to forget a specific node
func (*Admin) ForgetNodeByAddr ¶
ForgetNodeByAddr used to force other redis cluster node to forget a specific node
func (*Admin) GetClusterInfos ¶
func (a *Admin) GetClusterInfos() (*redis.ClusterInfos, error)
GetClusterInfos returns redis cluster infos from all clients
func (*Admin) GetClusterInfosSelected ¶
func (a *Admin) GetClusterInfosSelected(addr []string) (*redis.ClusterInfos, error)
GetClusterInfosSelected returns redis cluster infos from all clients
func (*Admin) GetHashMaxSlot ¶
GetHashMaxSlot get the max slot value
func (*Admin) GetKeysInSlot ¶
func (a *Admin) GetKeysInSlot(addr string, node redis.Slot, batch int, limit bool) ([]string, error)
GetKeysInSlot exec the redis command to get the keys in the given slot on the node we are connected to
func (*Admin) InitRedisCluster ¶
InitRedisCluster used to init a single node redis cluster
func (*Admin) MigrateKeys ¶
func (a *Admin) MigrateKeys(addr string, dest *redis.Node, slots []redis.Slot, batch, timeout int, replace bool) (int, error)
MigrateKeys use to migrate keys from slots to other slots
func (*Admin) RebuildConnectionMap ¶
func (a *Admin) RebuildConnectionMap(addrs []string, options *redis.AdminOptions)
RebuildConnectionMap rebuild the connection map according to the given addresse
func (*Admin) StartFailover ¶
StartFailover used to force the failover of a specific redis master node
type ClusterInfosRetType ¶
type ClusterInfosRetType struct { ClusterInfos *redis.ClusterInfos Err error }
ClusterInfosRetType structure to describe the return data of GetClusterInfosRet method
type Connections ¶
type Connections struct {
// contains filtered or unexported fields
}
Connections fake redis connection handler, do nothing
func (*Connections) Add ¶
func (cnx *Connections) Add(addr string) error
Add connect to the given address and register the client connection to the map
func (*Connections) AddAll ¶
func (cnx *Connections) AddAll(addrs []string)
AddAll connect to the given list of addresses and register them in the map fail silently
func (*Connections) Close ¶
func (cnx *Connections) Close()
Close used to close all possible resources instanciate by the Connections
func (*Connections) Get ¶
func (cnx *Connections) Get(addr string) (redis.ClientInterface, error)
Get returns a client connection for the given adress, connects if the connection is not in the map yet
func (*Connections) GetAll ¶
func (cnx *Connections) GetAll() map[string]redis.ClientInterface
GetAll returns a map of all clients per address
func (*Connections) GetDifferentFrom ¶
func (cnx *Connections) GetDifferentFrom(addr string) (redis.ClientInterface, error)
GetDifferentFrom returns random a client connection different from given address
func (*Connections) GetRandom ¶
func (cnx *Connections) GetRandom() (redis.ClientInterface, error)
GetRandom returns a client connection to a random node of the client map
func (*Connections) GetSelected ¶
func (cnx *Connections) GetSelected(addrs []string) map[string]redis.ClientInterface
GetSelected returns a map of all clients per address
func (*Connections) Reconnect ¶
func (cnx *Connections) Reconnect(addr string) error
Reconnect force a reconnection on the given address is the adress is not part of the map, act like Add
func (*Connections) Remove ¶
func (cnx *Connections) Remove(addr string)
Remove disconnect and remove the client connection from the map
func (*Connections) ReplaceAll ¶
func (cnx *Connections) ReplaceAll(addrs []string)
ReplaceAll clear the pool and re-populate it with new connections fail silently
func (*Connections) Reset ¶
func (cnx *Connections) Reset()
Reset close all connections and clear the connection map
func (*Connections) ValidatePipeResp ¶
func (cnx *Connections) ValidatePipeResp(client redis.ClientInterface, addr, errMessage string) bool
ValidatePipeResp wait for all answers in the pipe and validate the response in case of network issue clear the pipe and return in case of error, return false
func (*Connections) ValidateResp ¶
func (cnx *Connections) ValidateResp(resp *radix.Resp, addr, errMessage string) error
ValidateResp check the redis resp, eventually reconnect on connection error in case of error, customize the error, log it and return it
type CountKeysInSlotRetType ¶
CountKeysInSlotRetType structure to describe the return data of CountKeysInSlot method
type GetClusterInfoRetType ¶
GetClusterInfoRetType structure to describe the return data of GetClusterInfo method
type GetKeysInSlotRetType ¶
GetKeysInSlotRetType structure to describe the return data of GetKeysInSlot method
type MigrateKeyRetType ¶
MigrateKeyRetType structure to describe the return data of the MigrateKey method