Skip to content

Commit

Permalink
add lint
Browse files Browse the repository at this point in the history
  • Loading branch information
YIDWang committed Nov 11, 2018
1 parent 9d315d5 commit b7b691a
Show file tree
Hide file tree
Showing 11 changed files with 187 additions and 142 deletions.
6 changes: 3 additions & 3 deletions bin/thanos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func main() {
}
}

//Logger zap logger
//GlobalLogger zap logger
func GlobalLogger(level, name string, write io.Writer) error {
var lv = zap.NewAtomicLevel()
switch level {
Expand All @@ -103,7 +103,7 @@ func GlobalLogger(level, name string, write io.Writer) error {
case "fatal":
lv.SetLevel(zap.FatalLevel)
default:
return fmt.Errorf("unknown log level(%s)\n", level)
return fmt.Errorf("unknown log level(%s)", level)
}
timeEncoder := func(t time.Time, enc zapcore.PrimitiveArrayEncoder) {
enc.AppendString(t.Local().Format("2006-01-02 15:04:05.999999999"))
Expand Down Expand Up @@ -158,7 +158,7 @@ func TikvLogrus(path, level, pattern string, compress bool) error {
case "fatal":
logrus.SetLevel(logrus.FatalLevel)
default:
return fmt.Errorf("unknown log level(%s)\n", level)
return fmt.Errorf("unknown log level(%s)", level)
}
return nil
}
Expand Down
24 changes: 12 additions & 12 deletions command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ type Context struct {
}

const (
BitMaxOffset = 232
BitValueZero = 0
BitValueOne = 1
// BitMaxOffset = 232
// BitValueZero = 0
// BitValueOne = 1

MaxRangeInteger = 2<<29 - 1
// MaxRangeInteger = 2<<29 - 1
)

// Command is a redis command implementation
Expand Down Expand Up @@ -116,13 +116,13 @@ func Call(ctx *Context) {
return
}

cmdInfo, ok := commands[name]
cmdInfoCommand, ok := commands[name]
if !ok {
resp.ReplyError(ctx.Out, "ERR unknown command '"+ctx.Name+"'")
return
}
argc := len(ctx.Args) + 1 // include the command name
arity := cmdInfo.Cons.Arity
arity := cmdInfoCommand.Cons.Arity
if arity > 0 && argc != arity {
resp.ReplyError(ctx.Out, "ERR wrong number of arguments for '"+ctx.Name+"' command")
return
Expand All @@ -144,11 +144,11 @@ func Call(ctx *Context) {

feedMonitors(ctx)
start := time.Now()
cmdInfo.Proc(ctx)
cmdInfoCommand.Proc(ctx)
cost := time.Since(start)

cmdInfo.Stat.Calls++
cmdInfo.Stat.Microseconds += cost.Nanoseconds() / int64(1000)
cmdInfoCommand.Stat.Calls++
cmdInfoCommand.Stat.Microseconds += cost.Nanoseconds() / int64(1000)
}

// TxnCall call command with transaction, it is used with multi/exec
Expand Down Expand Up @@ -219,7 +219,7 @@ func feedMonitors(ctx *Context) {
// Executor execute any command
type Executor struct {
txnCommands map[string]TxnCommand
commands map[string]CommandInfo
commands map[string]InfoCommand
}

// NewExecutor new a Executor object
Expand All @@ -232,8 +232,8 @@ func (e *Executor) Execute(ctx *Context) {
Call(ctx)
}

// CommandInfo combines command procedure, constraint and statistics
type CommandInfo struct {
// InfoCommand combines command procedure, constraint and statistics
type InfoCommand struct {
Proc Command
Stat Statistic
Cons Constraint
Expand Down
17 changes: 11 additions & 6 deletions command/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ import (
"strconv"
)

const TokenSignLen = 11
//tokenSignLen token default len
const tokenSignLen = 11

//Base token base msg
type Base struct {
Version int8 `json:"version"`
CreateAt int64 `json:"create_at"`
Namespace []byte `json:"namespace"`
// Sign string `json:"-"`
}

// Namespace SHOULD NOT contains a colon
//MarshalBinary Namespace SHOULD NOT contains a colon
func (t *Base) MarshalBinary() (data []byte, err error) {
data = append(data, t.Namespace...)
data = append(data, '-')
Expand All @@ -28,6 +30,7 @@ func (t *Base) MarshalBinary() (data []byte, err error) {
return data, nil
}

//UnmarshalBinary token base unmarshl
func (t *Base) UnmarshalBinary(data []byte) error {
fields := bytes.Split(data, []byte{'-'})
l := len(fields)
Expand All @@ -52,21 +55,22 @@ func (t *Base) UnmarshalBinary(data []byte) error {
return nil
}

//Verify token auth
func Verify(token, key []byte) ([]byte, error) {
encodedSignLen := hex.EncodedLen(TokenSignLen)
encodedSignLen := hex.EncodedLen(tokenSignLen)
if len(token) < encodedSignLen || len(key) == 0 {
return nil, errors.New("token or key is parameter illegal")

}

sign := make([]byte, TokenSignLen)
sign := make([]byte, tokenSignLen)
hex.Decode(sign, token[len(token)-encodedSignLen:])

meta := token[:len(token)-encodedSignLen-1] //counting in the ":"
mac := hmac.New(sha256.New, key)
mac.Write(meta)

if !hmac.Equal(mac.Sum(nil)[:TokenSignLen], sign) {
if !hmac.Equal(mac.Sum(nil)[:tokenSignLen], sign) {
return nil, errors.New("token mismatch")
}

Expand All @@ -77,6 +81,7 @@ func Verify(token, key []byte) ([]byte, error) {
return t.Namespace, nil
}

//Token token create through key server namespace create time
func Token(key, namespace []byte, createAt int64) ([]byte, error) {
t := &Base{Namespace: namespace, CreateAt: createAt, Version: 1}
data, err := t.MarshalBinary()
Expand All @@ -90,7 +95,7 @@ func Token(key, namespace []byte, createAt int64) ([]byte, error) {

//truncate to 32 byte: https://tools.ietf.org/html/rfc2104#section-5
// we have 11 byte rigth of hmac,so the rest of data is token message
sign = sign[:TokenSignLen]
sign = sign[:tokenSignLen]

encodedSign := make([]byte, hex.EncodedLen(len(sign)))
hex.Encode(encodedSign, sign)
Expand Down
9 changes: 5 additions & 4 deletions command/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
// ErrInvalidDB invalid DB index
ErrInvalidDB = errors.New("ERR invalid DB index")

// ErrTikv TIKV ERROR
//ErrExpire expire time in set
ErrExpire = errors.New("ERR invalid expire time in set")

// ErrInteger value is not an integer or out of range
Expand Down Expand Up @@ -78,10 +78,11 @@ var (

// ErrMultiNested indicates a nested multi command which is not allowed
ErrMultiNested = errors.New("ERR MULTI calls can not be nested")
// ErrTypeMismatchi Operation against a key holding the wrong kind of value

// ErrTypeMismatch Operation against a key holding the wrong kind of value
ErrTypeMismatch = errors.New(" WRONGTYPE Operation against a key holding the wrong kind of value")
//EmptyArray error
EmptyArray = errors.New("EmptyArray error")
//ErrEmptyArray error
ErrEmptyArray = errors.New("EmptyArray error")
)

//ErrUnKnownCommand return RedisError of the cmd
Expand Down
140 changes: 70 additions & 70 deletions command/init.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package command

var txnCommands map[string]TxnCommand
var commands map[string]CommandInfo
var commands map[string]InfoCommand

func init() {
// txnCommands will be searched in multi/exec
Expand Down Expand Up @@ -77,89 +77,89 @@ func init() {

// commands contains all commands that open to clients
// exec should not be in this table to avoid 'initialization loop', and it indeed not necessary be here in fact.
commands = map[string]CommandInfo{
commands = map[string]InfoCommand{
// connections
"auth": CommandInfo{Proc: Auth, Cons: Constraint{2, flags("sltF"), 0, 0, 0}},
"echo": CommandInfo{Proc: Echo, Cons: Constraint{2, flags("F"), 0, 0, 0}},
"ping": CommandInfo{Proc: Ping, Cons: Constraint{-1, flags("tF"), 0, 0, 0}},
"quit": CommandInfo{Proc: Quit, Cons: Constraint{1, 0, 0, 0, 0}},
"select": CommandInfo{Proc: Select, Cons: Constraint{2, flags("lF"), 0, 0, 0}},
"swapdb": CommandInfo{Proc: SwapDB, Cons: Constraint{3, flags("wF"), 0, 0, 0}},
"auth": InfoCommand{Proc: Auth, Cons: Constraint{2, flags("sltF"), 0, 0, 0}},
"echo": InfoCommand{Proc: Echo, Cons: Constraint{2, flags("F"), 0, 0, 0}},
"ping": InfoCommand{Proc: Ping, Cons: Constraint{-1, flags("tF"), 0, 0, 0}},
"quit": InfoCommand{Proc: Quit, Cons: Constraint{1, 0, 0, 0, 0}},
"select": InfoCommand{Proc: Select, Cons: Constraint{2, flags("lF"), 0, 0, 0}},
"swapdb": InfoCommand{Proc: SwapDB, Cons: Constraint{3, flags("wF"), 0, 0, 0}},

// transactions, exec and discard should called explicitly, so they are registered here
"multi": CommandInfo{Proc: Multi, Cons: Constraint{1, flags("sF"), 0, 0, 0}},
"watch": CommandInfo{Proc: Watch, Cons: Constraint{-2, flags("sF"), 1, -1, 1}},
"unwatch": CommandInfo{Proc: Unwatch, Cons: Constraint{1, flags("sF"), 0, 0, 0}},
"multi": InfoCommand{Proc: Multi, Cons: Constraint{1, flags("sF"), 0, 0, 0}},
"watch": InfoCommand{Proc: Watch, Cons: Constraint{-2, flags("sF"), 1, -1, 1}},
"unwatch": InfoCommand{Proc: Unwatch, Cons: Constraint{1, flags("sF"), 0, 0, 0}},

// lists
"lpush": CommandInfo{Proc: AutoCommit(LPush), Cons: Constraint{-3, flags("wmF"), 1, 1, 1}},
"lpop": CommandInfo{Proc: AutoCommit(LPop), Cons: Constraint{2, flags("wF"), 1, 1, 1}},
"lrange": CommandInfo{Proc: AutoCommit(LRange), Cons: Constraint{4, flags("r"), 1, 1, 1}},
"linsert": CommandInfo{Proc: AutoCommit(LInsert), Cons: Constraint{5, flags("wm"), 1, 1, 1}},
"lpush": InfoCommand{Proc: AutoCommit(LPush), Cons: Constraint{-3, flags("wmF"), 1, 1, 1}},
"lpop": InfoCommand{Proc: AutoCommit(LPop), Cons: Constraint{2, flags("wF"), 1, 1, 1}},
"lrange": InfoCommand{Proc: AutoCommit(LRange), Cons: Constraint{4, flags("r"), 1, 1, 1}},
"linsert": InfoCommand{Proc: AutoCommit(LInsert), Cons: Constraint{5, flags("wm"), 1, 1, 1}},

// strings
"get": CommandInfo{Proc: AutoCommit(Get), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"set": CommandInfo{Proc: AutoCommit(Set), Cons: Constraint{-3, flags("wm"), 1, 1, 1}},
"setnx": CommandInfo{Proc: AutoCommit(SetNx), Cons: Constraint{3, flags("wmF"), 1, 1, 1}},
"setex": CommandInfo{Proc: AutoCommit(SetEx), Cons: Constraint{4, flags("wm"), 1, 1, 1}},
"psetex": CommandInfo{Proc: AutoCommit(PSetEx), Cons: Constraint{4, flags("wm"), 1, 1, 1}},
"mget": CommandInfo{Proc: AutoCommit(MGet), Cons: Constraint{-2, flags("rF"), 1, -1, 1}},
"mset": CommandInfo{Proc: AutoCommit(MSet), Cons: Constraint{-3, flags("wm"), 1, -1, 2}},
"msetnx": CommandInfo{Proc: AutoCommit(MSetNx), Cons: Constraint{-3, flags("wm"), 1, -1, 2}},
"strlen": CommandInfo{Proc: AutoCommit(Strlen), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"append": CommandInfo{Proc: AutoCommit(Append), Cons: Constraint{3, flags("wm"), 1, 1, 1}},
// "setrange": CommandInfo{Proc: AutoCommit(SetRange), Cons: Constraint{4, flags("wm"), 1, 1, 1}},
"getrange": CommandInfo{Proc: AutoCommit(GetRange), Cons: Constraint{4, flags("r"), 1, 1, 1}},
"incr": CommandInfo{Proc: AutoCommit(Incr), Cons: Constraint{2, flags("wmF"), 1, 1, 1}},
"decr": CommandInfo{Proc: AutoCommit(Decr), Cons: Constraint{2, flags("wmF"), 1, 1, 1}},
"incrby": CommandInfo{Proc: AutoCommit(IncrBy), Cons: Constraint{3, flags("wmF"), 1, 1, 1}},
"decrby": CommandInfo{Proc: AutoCommit(DecrBy), Cons: Constraint{3, flags("wmF"), 1, 1, 1}},
"incrbyfloat": CommandInfo{Proc: AutoCommit(IncrByFloat), Cons: Constraint{3, flags("wmF"), 1, 1, 1}},
"get": InfoCommand{Proc: AutoCommit(Get), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"set": InfoCommand{Proc: AutoCommit(Set), Cons: Constraint{-3, flags("wm"), 1, 1, 1}},
"setnx": InfoCommand{Proc: AutoCommit(SetNx), Cons: Constraint{3, flags("wmF"), 1, 1, 1}},
"setex": InfoCommand{Proc: AutoCommit(SetEx), Cons: Constraint{4, flags("wm"), 1, 1, 1}},
"psetex": InfoCommand{Proc: AutoCommit(PSetEx), Cons: Constraint{4, flags("wm"), 1, 1, 1}},
"mget": InfoCommand{Proc: AutoCommit(MGet), Cons: Constraint{-2, flags("rF"), 1, -1, 1}},
"mset": InfoCommand{Proc: AutoCommit(MSet), Cons: Constraint{-3, flags("wm"), 1, -1, 2}},
"msetnx": InfoCommand{Proc: AutoCommit(MSetNx), Cons: Constraint{-3, flags("wm"), 1, -1, 2}},
"strlen": InfoCommand{Proc: AutoCommit(Strlen), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"append": InfoCommand{Proc: AutoCommit(Append), Cons: Constraint{3, flags("wm"), 1, 1, 1}},
// "setrange": InfoCommand{Proc: AutoCommit(SetRange), Cons: Constraint{4, flags("wm"), 1, 1, 1}},
"getrange": InfoCommand{Proc: AutoCommit(GetRange), Cons: Constraint{4, flags("r"), 1, 1, 1}},
"incr": InfoCommand{Proc: AutoCommit(Incr), Cons: Constraint{2, flags("wmF"), 1, 1, 1}},
"decr": InfoCommand{Proc: AutoCommit(Decr), Cons: Constraint{2, flags("wmF"), 1, 1, 1}},
"incrby": InfoCommand{Proc: AutoCommit(IncrBy), Cons: Constraint{3, flags("wmF"), 1, 1, 1}},
"decrby": InfoCommand{Proc: AutoCommit(DecrBy), Cons: Constraint{3, flags("wmF"), 1, 1, 1}},
"incrbyfloat": InfoCommand{Proc: AutoCommit(IncrByFloat), Cons: Constraint{3, flags("wmF"), 1, 1, 1}},

// keys
"type": CommandInfo{Proc: AutoCommit(Type), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"exists": CommandInfo{Proc: AutoCommit(Exists), Cons: Constraint{-2, flags("rF"), 1, -1, 1}},
"keys": CommandInfo{Proc: AutoCommit(Keys), Cons: Constraint{-2, flags("rS"), 0, 0, 0}},
"del": CommandInfo{Proc: AutoCommit(Delete), Cons: Constraint{-2, flags("w"), 1, -1, 1}},
"expire": CommandInfo{Proc: AutoCommit(Expire), Cons: Constraint{3, flags("wF"), 1, 1, 1}},
"expireat": CommandInfo{Proc: AutoCommit(ExpireAt), Cons: Constraint{3, flags("wF"), 1, 1, 1}},
"pexpire": CommandInfo{Proc: AutoCommit(PExpire), Cons: Constraint{3, flags("wF"), 1, 1, 1}},
"pexpireat": CommandInfo{Proc: AutoCommit(PExpireAt), Cons: Constraint{3, flags("wF"), 1, 1, 1}},
"persist": CommandInfo{Proc: AutoCommit(Persist), Cons: Constraint{2, flags("wF"), 1, 1, 1}},
"ttl": CommandInfo{Proc: AutoCommit(TTL), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"pttl": CommandInfo{Proc: AutoCommit(PTTL), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"object": CommandInfo{Proc: AutoCommit(Object), Cons: Constraint{-2, flags("rR"), 0, 0, 0}},
"scan": CommandInfo{Proc: AutoCommit(Scan), Cons: Constraint{-2, flags("rR"), 0, 0, 0}},
"randomkey": CommandInfo{Proc: AutoCommit(RandomKey), Cons: Constraint{1, flags("rR"), 0, 0, 0}},
"type": InfoCommand{Proc: AutoCommit(Type), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"exists": InfoCommand{Proc: AutoCommit(Exists), Cons: Constraint{-2, flags("rF"), 1, -1, 1}},
"keys": InfoCommand{Proc: AutoCommit(Keys), Cons: Constraint{-2, flags("rS"), 0, 0, 0}},
"del": InfoCommand{Proc: AutoCommit(Delete), Cons: Constraint{-2, flags("w"), 1, -1, 1}},
"expire": InfoCommand{Proc: AutoCommit(Expire), Cons: Constraint{3, flags("wF"), 1, 1, 1}},
"expireat": InfoCommand{Proc: AutoCommit(ExpireAt), Cons: Constraint{3, flags("wF"), 1, 1, 1}},
"pexpire": InfoCommand{Proc: AutoCommit(PExpire), Cons: Constraint{3, flags("wF"), 1, 1, 1}},
"pexpireat": InfoCommand{Proc: AutoCommit(PExpireAt), Cons: Constraint{3, flags("wF"), 1, 1, 1}},
"persist": InfoCommand{Proc: AutoCommit(Persist), Cons: Constraint{2, flags("wF"), 1, 1, 1}},
"ttl": InfoCommand{Proc: AutoCommit(TTL), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"pttl": InfoCommand{Proc: AutoCommit(PTTL), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"object": InfoCommand{Proc: AutoCommit(Object), Cons: Constraint{-2, flags("rR"), 0, 0, 0}},
"scan": InfoCommand{Proc: AutoCommit(Scan), Cons: Constraint{-2, flags("rR"), 0, 0, 0}},
"randomkey": InfoCommand{Proc: AutoCommit(RandomKey), Cons: Constraint{1, flags("rR"), 0, 0, 0}},

// server
"monitor": CommandInfo{Proc: Monitor, Cons: Constraint{1, flags("as"), 0, 0, 0}},
"client": CommandInfo{Proc: Client, Cons: Constraint{-2, flags("as"), 0, 0, 0}},
"debug": CommandInfo{Proc: AutoCommit(Debug), Cons: Constraint{-2, flags("as"), 0, 0, 0}},
"command": CommandInfo{Proc: CommandCommand, Cons: Constraint{0, flags("lt"), 0, 0, 0}},
"flushdb": CommandInfo{Proc: AutoCommit(FlushDB), Cons: Constraint{-1, flags("w"), 0, 0, 0}},
"flushall": CommandInfo{Proc: AutoCommit(FlushAll), Cons: Constraint{-1, flags("w"), 0, 0, 0}},
"time": CommandInfo{Proc: Time, Cons: Constraint{1, flags("RF"), 0, 0, 0}},
"info": CommandInfo{Proc: Info, Cons: Constraint{-1, flags("lt"), 0, 0, 0}},
"monitor": InfoCommand{Proc: Monitor, Cons: Constraint{1, flags("as"), 0, 0, 0}},
"client": InfoCommand{Proc: Client, Cons: Constraint{-2, flags("as"), 0, 0, 0}},
"debug": InfoCommand{Proc: AutoCommit(Debug), Cons: Constraint{-2, flags("as"), 0, 0, 0}},
"command": InfoCommand{Proc: RCommand, Cons: Constraint{0, flags("lt"), 0, 0, 0}},
"flushdb": InfoCommand{Proc: AutoCommit(FlushDB), Cons: Constraint{-1, flags("w"), 0, 0, 0}},
"flushall": InfoCommand{Proc: AutoCommit(FlushAll), Cons: Constraint{-1, flags("w"), 0, 0, 0}},
"time": InfoCommand{Proc: Time, Cons: Constraint{1, flags("RF"), 0, 0, 0}},
"info": InfoCommand{Proc: Info, Cons: Constraint{-1, flags("lt"), 0, 0, 0}},

// hashes
"hdel": CommandInfo{Proc: AutoCommit(HDel), Cons: Constraint{-3, flags("wF"), 1, 1, 1}},
"hset": CommandInfo{Proc: AutoCommit(HSet), Cons: Constraint{-4, flags("wmF"), 1, 1, 1}},
"hget": CommandInfo{Proc: AutoCommit(HGet), Cons: Constraint{3, flags("rF"), 1, 1, 1}},
"hgetall": CommandInfo{Proc: AutoCommit(HGetAll), Cons: Constraint{2, flags("r"), 1, 1, 1}},
"hexists": CommandInfo{Proc: AutoCommit(HExists), Cons: Constraint{3, flags("rF"), 1, 1, 1}},
"hincrby": CommandInfo{Proc: AutoCommit(HIncrBy), Cons: Constraint{4, flags("wmF"), 1, 1, 1}},
"hincrbyfloat": CommandInfo{Proc: AutoCommit(HIncrByFloat), Cons: Constraint{4, flags("wmF"), 1, 1, 1}},
"hkeys": CommandInfo{Proc: AutoCommit(HKeys), Cons: Constraint{2, flags("rS"), 1, 1, 1}},
"hvals": CommandInfo{Proc: AutoCommit(HVals), Cons: Constraint{2, flags("rS"), 1, 1, 1}},
"hlen": CommandInfo{Proc: AutoCommit(HLen), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"hstrlen": CommandInfo{Proc: AutoCommit(HStrLen), Cons: Constraint{3, flags("rF"), 1, 1, 1}},
"hsetnx": CommandInfo{Proc: AutoCommit(HSetNX), Cons: Constraint{4, flags("wmF"), 1, 1, 1}},
"hmget": CommandInfo{Proc: AutoCommit(HMGet), Cons: Constraint{-3, flags("rF"), 1, 1, 1}},
"hmset": CommandInfo{Proc: AutoCommit(HMSet), Cons: Constraint{-3, flags("wmF"), 1, 1, 1}},
"hdel": InfoCommand{Proc: AutoCommit(HDel), Cons: Constraint{-3, flags("wF"), 1, 1, 1}},
"hset": InfoCommand{Proc: AutoCommit(HSet), Cons: Constraint{-4, flags("wmF"), 1, 1, 1}},
"hget": InfoCommand{Proc: AutoCommit(HGet), Cons: Constraint{3, flags("rF"), 1, 1, 1}},
"hgetall": InfoCommand{Proc: AutoCommit(HGetAll), Cons: Constraint{2, flags("r"), 1, 1, 1}},
"hexists": InfoCommand{Proc: AutoCommit(HExists), Cons: Constraint{3, flags("rF"), 1, 1, 1}},
"hincrby": InfoCommand{Proc: AutoCommit(HIncrBy), Cons: Constraint{4, flags("wmF"), 1, 1, 1}},
"hincrbyfloat": InfoCommand{Proc: AutoCommit(HIncrByFloat), Cons: Constraint{4, flags("wmF"), 1, 1, 1}},
"hkeys": InfoCommand{Proc: AutoCommit(HKeys), Cons: Constraint{2, flags("rS"), 1, 1, 1}},
"hvals": InfoCommand{Proc: AutoCommit(HVals), Cons: Constraint{2, flags("rS"), 1, 1, 1}},
"hlen": InfoCommand{Proc: AutoCommit(HLen), Cons: Constraint{2, flags("rF"), 1, 1, 1}},
"hstrlen": InfoCommand{Proc: AutoCommit(HStrLen), Cons: Constraint{3, flags("rF"), 1, 1, 1}},
"hsetnx": InfoCommand{Proc: AutoCommit(HSetNX), Cons: Constraint{4, flags("wmF"), 1, 1, 1}},
"hmget": InfoCommand{Proc: AutoCommit(HMGet), Cons: Constraint{-3, flags("rF"), 1, 1, 1}},
"hmset": InfoCommand{Proc: AutoCommit(HMSet), Cons: Constraint{-3, flags("wmF"), 1, 1, 1}},

// sets
"sadd": CommandInfo{Proc: AutoCommit(SAdd), Cons: Constraint{-3, flags("wmF"), 1, 1, 1}},
"smembers": CommandInfo{Proc: AutoCommit(SMembers), Cons: Constraint{2, flags("rS"), 1, 1, 1}},
"sadd": InfoCommand{Proc: AutoCommit(SAdd), Cons: Constraint{-3, flags("wmF"), 1, 1, 1}},
"smembers": InfoCommand{Proc: AutoCommit(SMembers), Cons: Constraint{2, flags("rS"), 1, 1, 1}},
}
}
Loading

0 comments on commit b7b691a

Please sign in to comment.