summaryrefslogtreecommitdiff
path: root/src/module.c
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-09-26 11:58:52 +0200
committerGitHub <noreply@github.com>2019-09-26 11:58:52 +0200
commitc1ea6175c5353b37b15e418ddecb7cf87944ccb6 (patch)
treeef9b858b32575c81bbbbcb80a57060fcfc61bb6a /src/module.c
parent959fb5cf6879c5fb04e8fcf00efda4816e358d0d (diff)
parent52686f48664e8a01e556e6a7ee52013816514a26 (diff)
downloadredis-c1ea6175c5353b37b15e418ddecb7cf87944ccb6.tar.gz
Merge pull request #6024 from itamarhaber/info_modules
Adds a "Modules" section to `INFO`
Diffstat (limited to 'src/module.c')
-rw-r--r--src/module.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/module.c b/src/module.c
index a9db0a3a5..71fdd6b74 100644
--- a/src/module.c
+++ b/src/module.c
@@ -5363,6 +5363,25 @@ void addReplyLoadedModules(client *c) {
dictReleaseIterator(di);
}
+/* Helper function for the INFO command: adds loaded modules as to info's
+ * output.
+ *
+ * After the call, the passed sds info string is no longer valid and all the
+ * references must be substituted with the new pointer returned by the call. */
+sds genModulesInfoString(sds info) {
+ dictIterator *di = dictGetIterator(modules);
+ dictEntry *de;
+
+ while ((de = dictNext(di)) != NULL) {
+ sds name = dictGetKey(de);
+ struct RedisModule *module = dictGetVal(de);
+
+ info = sdscatprintf(info, "module:name=%s,ver=%d\r\n", name, module->ver);
+ }
+ dictReleaseIterator(di);
+ return info;
+}
+
/* Redis MODULE command.
*
* MODULE LOAD <path> [args...] */