From 2299c1f5093dd4eb27e69141a1370680f68237a4 Mon Sep 17 00:00:00 2001 From: Yoel Sherwin Date: Sun, 10 Apr 2022 23:02:19 +0300 Subject: [PATCH 1/2] add data types to module command --- src/module.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/module.c b/src/module.c index 0addeecde..2ad4b717d 100644 --- a/src/module.c +++ b/src/module.c @@ -12302,6 +12302,23 @@ void modulePipeReadable(aeEventLoop *el, int fd, void *privdata, int mask) { eventLoopHandleOneShotEvents(); } +/* Helper for addReplyLoadedModules(): given a list of modules, return + * an SDS string in the form "[datatype|datatype2|...]" */ +sds getModulesDataTypesList(list *l) { + listIter li; + listNode *ln; + listRewind(l, &li); + sds output = sdsnew("["); + while((ln = listNext(&li))) { + moduleType *mt = ln->value; + output = sdscat(output,mt->name); + if (ln != listLast(l)) + output = sdscat(output,"|"); + } + output = sdscat(output,"]"); + return output; +} + /* Helper function for the MODULE and HELLO command: send the list of the * loaded modules to the client. */ void addReplyLoadedModules(client *c) { @@ -12313,11 +12330,14 @@ void addReplyLoadedModules(client *c) { sds name = dictGetKey(de); struct RedisModule *module = dictGetVal(de); sds path = module->loadmod->path; + sds dataTypes = getModulesDataTypesList(module->types); addReplyMapLen(c,4); addReplyBulkCString(c,"name"); addReplyBulkCBuffer(c,name,sdslen(name)); addReplyBulkCString(c,"ver"); addReplyLongLong(c,module->ver); + addReplyBulkCString(c, "data types"); + addReplyBulkCBuffer(c, dataTypes, sdslen(dataTypes)); addReplyBulkCString(c,"path"); addReplyBulkCBuffer(c,path,sdslen(path)); addReplyBulkCString(c,"args"); From be21a726c3d2593a61af8cec5e262e1cb9b014a6 Mon Sep 17 00:00:00 2001 From: Yoel Sherwin Date: Wed, 13 Jul 2022 23:30:51 +0300 Subject: [PATCH 2/2] change comfigurations --- src/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index b26704283..8b79de14a 100644 --- a/src/config.c +++ b/src/config.c @@ -3139,7 +3139,7 @@ standardConfig static_configs[] = { createEnumConfig("sanitize-dump-payload", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, sanitize_dump_payload_enum, server.sanitize_dump_payload, SANITIZE_DUMP_NO, NULL, NULL), createEnumConfig("enable-protected-configs", NULL, IMMUTABLE_CONFIG, protected_action_enum, server.enable_protected_configs, PROTECTED_ACTION_ALLOWED_NO, NULL, NULL), createEnumConfig("enable-debug-command", NULL, IMMUTABLE_CONFIG, protected_action_enum, server.enable_debug_cmd, PROTECTED_ACTION_ALLOWED_NO, NULL, NULL), - createEnumConfig("enable-module-command", NULL, IMMUTABLE_CONFIG, protected_action_enum, server.enable_module_cmd, PROTECTED_ACTION_ALLOWED_NO, NULL, NULL), + createEnumConfig("enable-module-command", NULL, IMMUTABLE_CONFIG, protected_action_enum, server.enable_module_cmd, PROTECTED_ACTION_ALLOWED_LOCAL, NULL, NULL), createEnumConfig("cluster-preferred-endpoint-type", NULL, MODIFIABLE_CONFIG, cluster_preferred_endpoint_type_enum, server.cluster_preferred_endpoint_type, CLUSTER_ENDPOINT_TYPE_IP, NULL, NULL), createEnumConfig("propagation-error-behavior", NULL, MODIFIABLE_CONFIG, propagation_error_behavior_enum, server.propagation_error_behavior, PROPAGATION_ERR_BEHAVIOR_IGNORE, NULL, NULL), createEnumConfig("shutdown-on-sigint", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, shutdown_on_sig_enum, server.shutdown_on_sigint, 0, isValidShutdownOnSigFlags, NULL),