mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Fix fcall_ro key spec flags in commands.c (#10145)
In #10122, we modify the key spec flags to `RO` and `ACCESS`. But forgot to call generate-command-code.py. Also formatted it to follow the Python PEP8.
This commit is contained in:
parent
68a8d0b46d
commit
3720de78c9
@ -6613,7 +6613,7 @@ struct redisCommand redisCommandTable[] = {
|
||||
{"evalsha_ro","Execute a read-only Lua script server side","Depends on the script that is executed.","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SCRIPTING,EVALSHA_RO_History,EVALSHA_RO_Hints,evalShaRoCommand,-3,CMD_NOSCRIPT|CMD_SKIP_MONITOR|CMD_NO_MANDATORY_KEYS,ACL_CATEGORY_SCRIPTING,{{CMD_KEY_RO|CMD_KEY_ACCESS,KSPEC_BS_INDEX,.bs.index={2},KSPEC_FK_KEYNUM,.fk.keynum={0,1,1}}},evalGetKeys,.args=EVALSHA_RO_Args},
|
||||
{"eval_ro","Execute a read-only Lua script server side","Depends on the script that is executed.","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SCRIPTING,EVAL_RO_History,EVAL_RO_Hints,evalRoCommand,-3,CMD_NOSCRIPT|CMD_SKIP_MONITOR|CMD_NO_MANDATORY_KEYS,ACL_CATEGORY_SCRIPTING,{{CMD_KEY_RO|CMD_KEY_ACCESS,KSPEC_BS_INDEX,.bs.index={2},KSPEC_FK_KEYNUM,.fk.keynum={0,1,1}}},evalGetKeys,.args=EVAL_RO_Args},
|
||||
{"fcall","PATCH__TBD__38__","PATCH__TBD__37__","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SCRIPTING,FCALL_History,FCALL_Hints,fcallCommand,-3,CMD_NOSCRIPT|CMD_SKIP_MONITOR|CMD_MAY_REPLICATE|CMD_NO_MANDATORY_KEYS|CMD_STALE,ACL_CATEGORY_SCRIPTING,{{CMD_KEY_RW|CMD_KEY_ACCESS|CMD_KEY_UPDATE,KSPEC_BS_INDEX,.bs.index={2},KSPEC_FK_KEYNUM,.fk.keynum={0,1,1}}},functionGetKeys,.args=FCALL_Args},
|
||||
{"fcall_ro","PATCH__TBD__7__","PATCH__TBD__6__","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SCRIPTING,FCALL_RO_History,FCALL_RO_Hints,fcallroCommand,-3,CMD_NOSCRIPT|CMD_SKIP_MONITOR|CMD_NO_MANDATORY_KEYS|CMD_STALE,ACL_CATEGORY_SCRIPTING,{{CMD_KEY_RW|CMD_KEY_UPDATE,KSPEC_BS_INDEX,.bs.index={2},KSPEC_FK_KEYNUM,.fk.keynum={0,1,1}}},functionGetKeys,.args=FCALL_RO_Args},
|
||||
{"fcall_ro","PATCH__TBD__7__","PATCH__TBD__6__","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SCRIPTING,FCALL_RO_History,FCALL_RO_Hints,fcallroCommand,-3,CMD_NOSCRIPT|CMD_SKIP_MONITOR|CMD_NO_MANDATORY_KEYS|CMD_STALE,ACL_CATEGORY_SCRIPTING,{{CMD_KEY_RO|CMD_KEY_ACCESS,KSPEC_BS_INDEX,.bs.index={2},KSPEC_FK_KEYNUM,.fk.keynum={0,1,1}}},functionGetKeys,.args=FCALL_RO_Args},
|
||||
{"function","A container for function commands","Depends on subcommand.","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SCRIPTING,FUNCTION_History,FUNCTION_Hints,NULL,-2,0,0,.subcommands=FUNCTION_Subcommands},
|
||||
{"script","A container for Lua scripts management commands","Depends on subcommand.","2.6.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SCRIPTING,SCRIPT_History,SCRIPT_Hints,NULL,-2,0,0,.subcommands=SCRIPT_Subcommands},
|
||||
/* sentinel */
|
||||
|
@ -59,15 +59,16 @@ RESP3_TYPES = {
|
||||
"null": "RESP3_NULL",
|
||||
}
|
||||
|
||||
|
||||
def get_optional_desc_string(desc, field, force_uppercase=False):
|
||||
v = desc.get(field, None)
|
||||
if v and force_uppercase:
|
||||
v = v.upper()
|
||||
ret = "\"%s\"" % v if v else "NULL"
|
||||
return ret.replace("\n", "\\n")
|
||||
ret = "\"%s\"" % v if v else "NULL"
|
||||
return ret.replace("\n", "\\n")
|
||||
|
||||
|
||||
# Globals
|
||||
|
||||
subcommands = {} # container_name -> dict(subcommand_name -> Subcommand) - Only subcommands
|
||||
commands = {} # command_name -> Command - Only commands
|
||||
|
||||
@ -152,6 +153,7 @@ class Argument(object):
|
||||
Output example:
|
||||
"expiration",ARG_TYPE_ONEOF,NULL,NULL,NULL,CMD_ARG_OPTIONAL,.value.subargs=SET_expiration_Subargs
|
||||
"""
|
||||
|
||||
def _flags_code():
|
||||
s = ""
|
||||
if self.desc.get("optional", False):
|
||||
@ -245,6 +247,7 @@ class Command(object):
|
||||
Output example:
|
||||
"set","Set the string value of a key","O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_STRING,SET_History,SET_Hints,setCommand,-3,"write denyoom @string",{{"write read",KSPEC_BS_INDEX,.bs.index={1},KSPEC_FK_RANGE,.fk.range={0,1,0}}},.args=SET_Args
|
||||
"""
|
||||
|
||||
def _flags_code():
|
||||
s = ""
|
||||
for flag in self.desc.get("command_flags", []):
|
||||
@ -372,7 +375,7 @@ srcdir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../src")
|
||||
# Create all command objects
|
||||
print("Processing json files...")
|
||||
for filename in glob.glob('%s/commands/*.json' % srcdir):
|
||||
with open(filename,"r") as f:
|
||||
with open(filename, "r") as f:
|
||||
try:
|
||||
d = json.load(f)
|
||||
for name, desc in d.items():
|
||||
@ -393,7 +396,7 @@ for command in commands.values():
|
||||
command.subcommands.append(subcommand)
|
||||
|
||||
print("Generating commands.c...")
|
||||
with open("%s/commands.c" % srcdir,"w") as f:
|
||||
with open("%s/commands.c" % srcdir, "w") as f:
|
||||
f.write("/* Automatically generated by %s, do not edit. */\n\n" % os.path.basename(__file__))
|
||||
f.write("#include \"server.h\"\n")
|
||||
f.write(
|
||||
@ -420,4 +423,3 @@ with open("%s/commands.c" % srcdir,"w") as f:
|
||||
f.write("};\n")
|
||||
|
||||
print("All done, exiting.")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user