Documentation ¶
Index ¶
- type Admin
- func (a *Admin) AddSlots(ctx context.Context, addr string, slots redis.SlotSlice) error
- func (a *Admin) AttachNodeToCluster(ctx context.Context, addr string) error
- func (a *Admin) AttachReplicaToPrimary(ctx context.Context, replica *redis.Node, primary *redis.Node) error
- func (a *Admin) Close()
- func (a *Admin) Connections() redis.AdminConnectionsInterface
- func (a *Admin) CountKeysInSlot(ctx context.Context, addr string, node redis.Slot) (int64, error)
- func (a *Admin) DelSlots(ctx context.Context, addr string, slots redis.SlotSlice) error
- func (a *Admin) DeleteKeys(ctx context.Context, addr string, keys []string) error
- func (a *Admin) DetachReplica(ctx context.Context, replica *redis.Node) error
- func (a *Admin) FlushAll(ctx context.Context, addr string) error
- func (a *Admin) FlushAndReset(ctx context.Context, addr string, mode string) error
- func (a *Admin) ForgetNode(ctx context.Context, addr string) error
- func (a *Admin) ForgetNodeByAddr(ctx context.Context, addr string) error
- func (a *Admin) GetClusterInfos(ctx context.Context) (*redis.ClusterInfos, error)
- func (a *Admin) GetClusterInfosSelected(ctx context.Context, addr []string) (*redis.ClusterInfos, error)
- func (a *Admin) GetConfig(ctx context.Context, pattern string) (map[string]string, error)
- func (a *Admin) GetHashMaxSlot() redis.Slot
- func (a *Admin) GetKeys(ctx context.Context, addr string, slot redis.Slot, batch string) ([]string, error)
- func (a *Admin) GetKeysInSlot(ctx context.Context, addr string, node redis.Slot, batch string, limit bool) ([]string, error)
- func (a *Admin) InitRedisCluster(ctx context.Context, addr string) error
- func (a *Admin) MigrateKeys(ctx context.Context, source *redis.Node, dest *redis.Node, ...) error
- func (a *Admin) RebuildConnectionMap(ctx context.Context, addrs []string, options *redis.AdminOptions)
- func (a *Admin) SetConfig(ctx context.Context, addr string, config []string) error
- func (a *Admin) SetSlot(ctx context.Context, addr, action string, slot redis.Slot, node *redis.Node) error
- func (a *Admin) SetSlots(ctx context.Context, addr, action string, slots redis.SlotSlice, nodeID string, ...) error
- func (a *Admin) StartFailover(ctx context.Context, addr string) error
- type ClusterInfosRetType
- type Connections
- func (cnx *Connections) Add(ctx context.Context, addr string) error
- func (cnx *Connections) AddAll(ctx context.Context, addrs []string)
- func (cnx *Connections) Close()
- func (cnx *Connections) Get(ctx context.Context, 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(ctx context.Context, addr string) error
- func (cnx *Connections) Remove(addr string)
- func (cnx *Connections) ReplaceAll(ctx context.Context, addrs []string)
- func (cnx *Connections) Reset()
- func (cnx *Connections) ValidateResp(ctx context.Context, resp interface{}, err error, addr, errMessage string) error
- type CountKeysInSlotRetType
- type GetClusterInfoRetType
- type GetKeysInSlotRetType
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 // AddrError map from address to error returned from the function AddrError map[string]error // GetClusterInfosRet returned value for GetClusterInfos function GetClusterInfosRet ClusterInfosRetType // GetClusterInfosSelectedRet returned value for GetClusterInfos function GetClusterInfosSelectedRet ClusterInfosRetType // GetKeysInSlotRet map of returned data for GetKeysInSlot function GetKeysInSlotRet map[string]GetKeysInSlotRetType // CountKeysInSlotRet map of returned data for CountKeysInSlot function CountKeysInSlotRet map[string]CountKeysInSlotRetType // GetKeysRet map of returned data for GetKeys function GetKeysRet map[string]GetKeysInSlotRetType // 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 ¶
func NewFakeAdmin() *Admin
NewFakeAdmin returns new AdminInterface for fake admin
func (*Admin) AttachNodeToCluster ¶
AttachNodeToCluster connects a node to the cluster
func (*Admin) AttachReplicaToPrimary ¶
func (a *Admin) AttachReplicaToPrimary(ctx context.Context, replica *redis.Node, primary *redis.Node) error
AttachReplicaToPrimary attaches a replica to a primary node
func (*Admin) Close ¶
func (a *Admin) Close()
Close closes all possible resources instantiated by the Admin
func (*Admin) Connections ¶
func (a *Admin) Connections() redis.AdminConnectionsInterface
Connections returns a connection map
func (*Admin) CountKeysInSlot ¶
CountKeysInSlot counts the keys in the given slot
func (*Admin) DeleteKeys ¶
DeleteKeys uses DEL command to delete multiple keys
func (*Admin) DetachReplica ¶
DetachReplica detaches a replica from a primary
func (*Admin) FlushAndReset ¶
FlushAndReset resets the cluster configuration of the node
func (*Admin) ForgetNode ¶
ForgetNode forces a redis cluster node to forget a specific node
func (*Admin) ForgetNodeByAddr ¶
ForgetNodeByAddr forces a redis cluster node to forget a specific node by address
func (*Admin) GetClusterInfos ¶
GetClusterInfos returns redis cluster info from all clients
func (*Admin) GetClusterInfosSelected ¶
func (a *Admin) GetClusterInfosSelected(ctx context.Context, addr []string) (*redis.ClusterInfos, error)
GetClusterInfosSelected returns selected redis cluster info from all clients
func (*Admin) GetConfig ¶
GetConfig gets the running redis server configuration matching the pattern
func (*Admin) GetHashMaxSlot ¶
GetHashMaxSlot gets the max slot value
func (*Admin) GetKeys ¶
func (a *Admin) GetKeys(ctx context.Context, addr string, slot redis.Slot, batch string) ([]string, error)
GetKeys uses GETKEYSINSLOT command to get keys in a slot Number of keys returned specified by batch
func (*Admin) GetKeysInSlot ¶
func (a *Admin) GetKeysInSlot(ctx context.Context, addr string, node redis.Slot, batch string, limit bool) ([]string, error)
GetKeysInSlot gets the keys in the given slot
func (*Admin) InitRedisCluster ¶
InitRedisCluster init a single node redis cluster
func (*Admin) MigrateKeys ¶
func (a *Admin) MigrateKeys(ctx context.Context, source *redis.Node, dest *redis.Node, slots redis.SlotSlice, conf *rapi.RedisClusterSpec, replace, scaling bool, primaries redis.Nodes) error
MigrateKeys migrates keys from slots to other slots
func (*Admin) RebuildConnectionMap ¶
func (a *Admin) RebuildConnectionMap(ctx context.Context, addrs []string, options *redis.AdminOptions)
RebuildConnectionMap rebuilds the connection map according to the given addresses
func (*Admin) SetSlot ¶
func (a *Admin) SetSlot(ctx context.Context, addr, action string, slot redis.Slot, node *redis.Node) error
SetSlot uses SETSLOT command on a single slot
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(ctx context.Context, addr string) error
Add connect to the given address and register the client connection to the map
func (*Connections) AddAll ¶
func (cnx *Connections) AddAll(ctx context.Context, 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 instantiate by the Connections
func (*Connections) Get ¶
func (cnx *Connections) Get(ctx context.Context, 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(ctx context.Context, addr string) error
Reconnect force a reconnection on the given address is the address 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(ctx context.Context, 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) ValidateResp ¶
func (cnx *Connections) ValidateResp(ctx context.Context, resp interface{}, err error, addr, errMessage string) error
ValidateResp checks if the redis resp is empty and will attempt to 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