Apply comments #27 and change default mode for custom command conf

This commit is contained in:
Yoon 2018-04-09 10:12:15 +09:00
parent 7812aa8c4f
commit 2d93868e82
3 changed files with 6 additions and 14 deletions

View File

@ -10,40 +10,35 @@ CustomCommand {
# Currently support only 1 key with first argument. # Currently support only 1 key with first argument.
minArgs 3 # minimum arguments(including command itself), default is 2(key only) minArgs 3 # minimum arguments(including command itself), default is 2(key only)
maxArgs 3 # maximum arguments(including command itself), default is 2(key only) maxArgs 3 # maximum arguments(including command itself), default is 2(key only)
mode Read,Write # behavior or permission. Currently support Read, Write, Admin mode Read,Write # a command mode Read/Write/Admin is exclusive, Conf.cpp should check this.
# default is Read, Write
} }
# hello.repl2 <list-key> # hello.repl2 <list-key>
# just skipped since minArgs = 2, maxArgs = 2 are default values # just skipped since minArgs = 2, maxArgs = 2, mode = Read,Write are default values
hello.repl2 { hello.repl2 {
mode Read,Write
} }
# hello.toggle.case key # hello.toggle.case key
hello.toggle.case { hello.toggle.case {
mode Read,Write
} }
# hello.more.expire key milliseconds # hello.more.expire key milliseconds
hello.more.expire { hello.more.expire {
minArgs 3 minArgs 3
maxArgs 3 maxArgs 3
mode Read,Write
} }
# hello.zsumrange key startscore endscore # hello.zsumrange key startscore endscore
hello.zsumrange { hello.zsumrange {
minArgs 4 minArgs 4
maxArgs 4 maxArgs 4
mode Read,Write
} }
# hello.lexrange key min_lex max_lex min_age max_age # hello.lexrange key min_lex max_lex min_age max_age
hello.lexrange { hello.lexrange {
minArgs 6 minArgs 6
maxArgs 6 maxArgs 6
mode Read,Write
} }
# hello.hcopy key srcfield dstfield # hello.hcopy key srcfield dstfield
hello.hcopy { hello.hcopy {
minArgs 4 minArgs 4
maxArgs 4 maxArgs 4
mode Read,Write
} }
# from redis source src/modules/hellotype.c # from redis source src/modules/hellotype.c
@ -51,16 +46,13 @@ CustomCommand {
hello.insert { hello.insert {
minArgs 3 minArgs 3
maxArgs 3 maxArgs 3
mode Read,Write
} }
# hellotype.range key first count # hellotype.range key first count
hellotype.range { hellotype.range {
minArgs 4 minArgs 4
maxArgs 4 maxArgs 4
mode Read,Write
} }
# hellotype.len key # hellotype.len key
hello.len { hello.len {
mode Read,Wrie
} }
} }

View File

@ -93,7 +93,7 @@ Include try.conf
# Include dc.conf # Include dc.conf
################################### LATENCY #################################### ################################### COMMAND ####################################
## Custom command define, see command.conf ## Custom command define, see command.conf
## must be defined before Latency monitor ## must be defined before Latency monitor
#Include command.conf #Include command.conf

View File

@ -38,8 +38,8 @@ void CustomCommandConf::init(CustomCommandConf&c, const char* name, const int ty
c.cmd.type = (Command::Type)type; c.cmd.type = (Command::Type)type;
c.cmd.name = c.name.c_str(); c.cmd.name = c.name.c_str();
c.cmd.minArgs = 2; c.cmd.minArgs = 2;
c.cmd.maxArgs = 1; c.cmd.maxArgs = 2;
c.cmd.mode = Command::Write; c.cmd.mode = Command::Write|Command::Read;
} }
Conf::Conf(): Conf::Conf():