Documentation ¶
Index ¶
- Variables
- func CheckSlotDistributionEqual(src, dst []SlotOwner) bool
- func FixTopology(redisCfg *config.RedisConfig) error
- func FixVersion(redisCfg *config.RedisConfig) error
- func Float64ToByte(float float64) string
- func GetAllClusterShard(cli client.Redis, version string) ([]*config.RedisClusterShard, error)
- func GetAllClusterShard4(cli client.Redis) ([]*config.RedisClusterShard, error)
- func GetAllClusterShard7(cli client.Redis) ([]*config.RedisClusterShard, error)
- func GetClusterIsMigrating(cli client.Redis) (bool, error)
- func GetClusterSlotDistribution(cli client.Redis) (map[string]*config.RedisSlots, *config.RedisSlots, error)
- func GetRedisVersion(cli client.Redis) (string, error)
- func GetRunIds(cli client.Redis) (string, string, error)
- func HDel(cli client.Redis, key string, fileds ...string) error
- func HGet(cli client.Redis, key string, field string) (string, error)
- func HGetAll(cli client.Redis, key string) ([]string, error)
- func HSet(cli client.Redis, key string, pairs ...interface{}) error
- func Iocopy(r io.Reader, w io.Writer, p []byte, max int64) (int, error)
- func KeyToSlot(key string) uint16
- func ParseKeyspace(content []byte) (map[int32]int64, error)
- func ParseRedisInfo(content []byte) map[string]string
- func SelectDB(c client.Redis, db uint32) error
- type ClusterNodeInfo
- type RdbInfo
- type SRedisLocker
- type SlotOwner
- type StandaloneRedis
- func (sr *StandaloneRedis) AuthPassword(authType, passwd string) error
- func (sr *StandaloneRedis) Client() client.Redis
- func (sr *StandaloneRedis) Close() error
- func (sr *StandaloneRedis) GetInfoReplication() (string, string, error)
- func (sr *StandaloneRedis) SelectDB(db int) error
- func (sr *StandaloneRedis) SendPSync(runid string, offset int64) (string, int64, <-chan *RdbInfo, error)
- func (sr *StandaloneRedis) SendPSyncAck(offset int64) error
- func (sr *StandaloneRedis) SendPSyncListeningPort(port int) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrLockBusy = errors.New("locker is busy")
)
Functions ¶
func FixTopology ¶
func FixTopology(redisCfg *config.RedisConfig) error
func FixVersion ¶ added in v1.0.0
func FixVersion(redisCfg *config.RedisConfig) error
func Float64ToByte ¶
func GetAllClusterShard ¶
func GetAllClusterShard4 ¶
func GetAllClusterShard4(cli client.Redis) ([]*config.RedisClusterShard, error)
func GetAllClusterShard7 ¶
func GetAllClusterShard7(cli client.Redis) ([]*config.RedisClusterShard, error)
func GetClusterSlotDistribution ¶
func GetClusterSlotDistribution(cli client.Redis) (map[string]*config.RedisSlots, *config.RedisSlots, error)
func ParseRedisInfo ¶
parse single info field: "info server", "info keyspace"
Types ¶
type ClusterNodeInfo ¶
type ClusterNodeInfo struct { Id string Address string NodeCoordinates string Role string Flags []string SlaveOf string PingSent string PongRecv string ConfigEpoch string LinkStat string Slots []string MigratingSlots []string }
func ClusterNodeChoose ¶
func ClusterNodeChoose(input []*ClusterNodeInfo, role config.RedisRole) []*ClusterNodeInfo
func ParseClusterNode ¶
func ParseClusterNode(content string) []*ClusterNodeInfo
$1181 dc60792a35b30e6319b5866af83e131237ae37a4 :0@0 master,noaddr - 1699408763709 1699408763705 14 disconnected 244-666 5463-6128 10924-11589 66f3b61e5fc02d8d58e8b4d58b40a0cd82d6d000 127.0.0.1:6312@16312 master - 0 1699408793761 9 connected 12175-16383 30150e71a32620bb2716de769a25537b97774bb0 127.0.0.1:6304@16304 master - 0 1699408791000 15 connected 0-243 667-1252 6129-6713 11590-12174 75ec6340807933b3b827f662d4847457f49007aa 127.0.0.1:6311@16311 slave 828c9cdfa7faec4f4d2fbc5342d09879510dc8b3 0 1699408791000 10 connected d41296ff6badbbfa36b05c90ceafed3c4583393a :0@0 slave,noaddr 66f3b61e5fc02d8d58e8b4d58b40a0cd82d6d000 1699408763709 1699408763706 9 disconnected 828c9cdfa7faec4f4d2fbc5342d09879510dc8b3 :0@0 master,noaddr - 1699408763709 1699408763705 10 disconnected 6714-10922 3de1044bfe52eab099e956f146bde4a1278b185e 127.0.0.1:6303@16303 myself,slave 166585d6a8976b203f80897d6deec69607457eb3 0 1699408793000 16 connected 166585d6a8976b203f80897d6deec69607457eb3 127.0.0.1:6310@16310 master - 0 1699408792000 16 connected 1253-5462 10923 cc6572e1b59efeec31d79fe532acd144947c99ce 127.0.0.1:6314@16314 slave 30150e71a32620bb2716de769a25537b97774bb0 0 1699408792755 15 connected
type SRedisLocker ¶
type SRedisLocker struct {
// contains filtered or unexported fields
}
standalone redis lock, non-distributed
func NewSRedisLocker ¶
func NewSRedisLocker(redisCfg config.RedisConfig, key string, value string, expireMs int) (*SRedisLocker, error)
func (*SRedisLocker) Close ¶
func (srl *SRedisLocker) Close() error
func (*SRedisLocker) Lock ¶
func (srl *SRedisLocker) Lock() error
func (*SRedisLocker) Renew ¶
func (srl *SRedisLocker) Renew() error
func (*SRedisLocker) Unlock ¶
func (srl *SRedisLocker) Unlock() error
type StandaloneRedis ¶
type StandaloneRedis struct {
// contains filtered or unexported fields
}
func NewStandaloneRedis ¶
func NewStandaloneRedis(cfg config.RedisConfig) (*StandaloneRedis, error)
func (*StandaloneRedis) AuthPassword ¶
func (sr *StandaloneRedis) AuthPassword(authType, passwd string) error
func (*StandaloneRedis) Client ¶
func (sr *StandaloneRedis) Client() client.Redis
func (*StandaloneRedis) Close ¶
func (sr *StandaloneRedis) Close() error
func (*StandaloneRedis) GetInfoReplication ¶
func (sr *StandaloneRedis) GetInfoReplication() (string, string, error)
func (*StandaloneRedis) SelectDB ¶
func (sr *StandaloneRedis) SelectDB(db int) error
func (*StandaloneRedis) SendPSyncAck ¶
func (sr *StandaloneRedis) SendPSyncAck(offset int64) error
func (*StandaloneRedis) SendPSyncListeningPort ¶
func (sr *StandaloneRedis) SendPSyncListeningPort(port int) error