Documentation ¶
Index ¶
- Constants
- Variables
- func CheckFilter(filterTree *Trie, keyBytes []byte) bool
- func CompareUnorderedList(a, b []string) bool
- func FilterDBList(dbs string) map[int]struct{}
- func GetAllClusterNode(client redigo.Conn, role string, choose string) ([]string, error)
- func HandleLogLevel(logLevel string) (string, error)
- func InitLog(logFile string, logLevel string) (seelog.LoggerInterface, error)
- func Min(a, b int) int
- func NewClusterConn(clusterClient *redigoCluster.Cluster, recvChanSize int) redigo.Conn
- func ParseInfo(content []byte) map[string]string
- func ParseKeyspace(content []byte) (map[int32]int64, error)
- func ValueHelper_Hash_SortedSet(reply interface{}) map[string][]byte
- func ValueHelper_List(reply interface{}) [][]byte
- func ValueHelper_Set(reply interface{}) map[string][]byte
- type Attribute
- type ClusterConn
- func (cc *ClusterConn) Close() error
- func (cc *ClusterConn) Do(commandName string, args ...interface{}) (reply interface{}, err error)
- func (cc *ClusterConn) Err() error
- func (cc *ClusterConn) Flush() error
- func (cc *ClusterConn) Receive() (reply interface{}, err error)
- func (cc *ClusterConn) Send(commandName string, args ...interface{}) error
- type ClusterNodeInfo
- type ConflictType
- type Field
- type Key
- type KeyType
- type KeyTypeIndex
- type Qos
- type Trie
- type TrieNode
Constants ¶
const ( MaxRetryCount = 20 // client attribute StatRollFrequency = 2 // client attribute TypeChanged int64 = -1 // marks the given key type is change, e.g. from string to list // db type TypeDB = 0 // db TypeCluster = 1 TypeAliyunProxy = 2 // aliyun proxy TypeTencentProxy = 3 // tencent cloud proxy TypeMaster = "master" TypeSlave = "slave" TypeAll = "all" Splitter = ";" )
const (
RecvChanSize = 4096
)
const (
Star = byte('*')
)
Variables ¶
var ( BigKeyThreshold int64 = 16384 Logger seelog.LoggerInterface )
var EndKeyType = &KeyType{ Name: "unknown", Index: EndKeyTypeIndex, FetchLenCommand: "unknown", }
var HashKeyType = &KeyType{ Name: "hash", Index: HashTypeIndex, FetchLenCommand: "hlen", }
var ListKeyType = &KeyType{ Name: "list", Index: ListTypeIndex, FetchLenCommand: "llen", }
var NoneKeyType = &KeyType{ Name: "none", Index: NoneTypeIndex, FetchLenCommand: "strlen", }
var SetKeyType = &KeyType{ Name: "set", Index: SetTypeIndex, FetchLenCommand: "scard", }
var StreamKeyType = &KeyType{ Name: "stream", Index: StreamTypeIndex, FetchLenCommand: "xlen", }
var StringKeyType = &KeyType{ Name: "string", Index: StringTypeIndex, FetchLenCommand: "strlen", }
var ZsetKeyType = &KeyType{ Name: "zset", Index: ZsetTypeIndex, FetchLenCommand: "zcard", }
Functions ¶
func CheckFilter ¶
* @Vinllen Chen. check filter hit the key. * return: true/false. true means pass. * Actually, it's better to use trie tree instead of for-loop brute way. The reason I choose this is because * input filterList is not long in general, and I'm a lazy guy~.
func CompareUnorderedList ¶
compare two unordered list. return true means equal.
func FilterDBList ¶
func GetAllClusterNode ¶
return id list if choose == "id", otherwise address
func HandleLogLevel ¶
func NewClusterConn ¶
func NewClusterConn(clusterClient *redigoCluster.Cluster, recvChanSize int) redigo.Conn
func ParseInfo ¶
ParseInfo convert result of info command to map[string]string. For example, "opapply_source_count:1\r\nopapply_source_0:server_id=3171317,applied_opid=1\r\n" is converted to map[string]string{"opapply_source_count": "1", "opapply_source_0": "server_id=3171317,applied_opid=1"}.
func ValueHelper_List ¶
func ValueHelper_List(reply interface{}) [][]byte
func ValueHelper_Set ¶
Types ¶
type ClusterConn ¶
type ClusterConn struct {
// contains filtered or unexported fields
}
implement redigo.Conn(https://github.com/garyburd/redigo) * Embed redis-go-cluster(https://github.com/chasex/redis-go-cluster) * The reason I create this struct is that redis-go-cluster isn't fulfill redigo.Conn * interface. So I implement "Err", "Send", "Flush" and "Receive" interfaces.
func (*ClusterConn) Close ¶
func (cc *ClusterConn) Close() error
func (*ClusterConn) Do ¶
func (cc *ClusterConn) Do(commandName string, args ...interface{}) (reply interface{}, err error)
func (*ClusterConn) Err ¶
func (cc *ClusterConn) Err() error
func (*ClusterConn) Flush ¶
func (cc *ClusterConn) Flush() error
send batcher and put the return into recvChan
func (*ClusterConn) Receive ¶
func (cc *ClusterConn) Receive() (reply interface{}, err error)
read recvChan
func (*ClusterConn) Send ¶
func (cc *ClusterConn) Send(commandName string, args ...interface{}) error
just add into batcher
type ClusterNodeInfo ¶
type ClusterNodeInfo struct { Id string Address string Flags string Master string PingSent string PongRecv string ConfigEpoch string LinkStat string Slot string }
func ClusterNodeChoose ¶
func ClusterNodeChoose(input []*ClusterNodeInfo, role string) []*ClusterNodeInfo
needMaster: true(master), false(slave)
func ParseClusterNode ¶
func ParseClusterNode(content []byte) []*ClusterNodeInfo
* 10.1.1.1:21331> cluster nodes * d49a4c7b516b8da222d46a0a589b77f381285977 10.1.1.1:21333@31333 master - 0 1557996786000 3 connected 10923-16383 * f23ba7be501b2dcd4d6eeabd2d25551513e5c186 10.1.1.1:21336@31336 slave d49a4c7b516b8da222d46a0a589b77f381285977 0 1557996785000 6 connected * 75fffcd521738606a919607a7ddd52bcd6d65aa8 10.1.1.1:21331@31331 myself,master - 0 1557996784000 1 connected 0-5460 * da3dd51bb9cb5803d99942e0f875bc5f36dc3d10 10.1.1.1:21332@31332 master - 0 1557996786260 2 connected 5461-10922 * eff4e654d3cc361a8ec63640812e394a8deac3d6 10.1.1.1:21335@31335 slave da3dd51bb9cb5803d99942e0f875bc5f36dc3d10 0 1557996787261 5 connected * 486e081f8d47968df6a7e43ef9d3ba93b77d03b2 10.1.1.1:21334@31334 slave 75fffcd521738606a919607a7ddd52bcd6d65aa8 0 1557996785258 4 connected
type ConflictType ¶
type ConflictType int
const ( TypeConflict ConflictType = iota ValueConflict LackSourceConflict LackTargetConflict NoneConflict EndConflict )
func NewConflictType ¶
func NewConflictType(a string) ConflictType
func (ConflictType) String ¶
func (p ConflictType) String() string
type Field ¶
type Field struct { Field []byte ConflictType ConflictType }
type KeyType ¶
type KeyType struct { Name string // type Index KeyTypeIndex FetchLenCommand string }
func NewKeyType ¶
type KeyTypeIndex ¶
type KeyTypeIndex int
const ( StringTypeIndex KeyTypeIndex = iota HashTypeIndex ListTypeIndex SetTypeIndex ZsetTypeIndex StreamTypeIndex NoneTypeIndex EndKeyTypeIndex )
func (KeyTypeIndex) String ¶
func (p KeyTypeIndex) String() string