From 2d93868e823d586162f8d50caee3921015bcb933 Mon Sep 17 00:00:00 2001 From: Yoon Date: Mon, 9 Apr 2018 10:12:15 +0900 Subject: [PATCH] Apply comments #27 and change default mode for custom command conf --- conf/command.conf | 14 +++----------- conf/predixy.conf | 2 +- src/Conf.cpp | 4 ++-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/conf/command.conf b/conf/command.conf index 0e06a56..d3704b8 100644 --- a/conf/command.conf +++ b/conf/command.conf @@ -10,40 +10,35 @@ CustomCommand { # Currently support only 1 key with first argument. minArgs 3 # minimum 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 - # 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 { - mode Read,Write } # hello.toggle.case key hello.toggle.case { - mode Read,Write } # hello.more.expire key milliseconds hello.more.expire { minArgs 3 maxArgs 3 - mode Read,Write } # hello.zsumrange key startscore endscore hello.zsumrange { minArgs 4 maxArgs 4 - mode Read,Write } # hello.lexrange key min_lex max_lex min_age max_age hello.lexrange { minArgs 6 maxArgs 6 - mode Read,Write } # hello.hcopy key srcfield dstfield hello.hcopy { minArgs 4 maxArgs 4 - mode Read,Write } # from redis source src/modules/hellotype.c @@ -51,16 +46,13 @@ CustomCommand { hello.insert { minArgs 3 maxArgs 3 - mode Read,Write } # hellotype.range key first count hellotype.range { minArgs 4 maxArgs 4 - mode Read,Write } # hellotype.len key hello.len { - mode Read,Wrie } } diff --git a/conf/predixy.conf b/conf/predixy.conf index 06e4c83..a9f3ae1 100644 --- a/conf/predixy.conf +++ b/conf/predixy.conf @@ -93,7 +93,7 @@ Include try.conf # Include dc.conf -################################### LATENCY #################################### +################################### COMMAND #################################### ## Custom command define, see command.conf ## must be defined before Latency monitor #Include command.conf diff --git a/src/Conf.cpp b/src/Conf.cpp index c95d921..44dd0e9 100644 --- a/src/Conf.cpp +++ b/src/Conf.cpp @@ -38,8 +38,8 @@ void CustomCommandConf::init(CustomCommandConf&c, const char* name, const int ty c.cmd.type = (Command::Type)type; c.cmd.name = c.name.c_str(); c.cmd.minArgs = 2; - c.cmd.maxArgs = 1; - c.cmd.mode = Command::Write; + c.cmd.maxArgs = 2; + c.cmd.mode = Command::Write|Command::Read; } Conf::Conf():