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. */
| 8722 | * After the call, the passed sds info string is no longer valid and all the |
| 8723 | * references must be substituted with the new pointer returned by the call. */ |
| 8724 | sds genModulesInfoString(sds info) { |
| 8725 | dictIterator *di = dictGetIterator(modules); |
| 8726 | dictEntry *de; |
| 8727 | |
| 8728 | while ((de = dictNext(di)) != NULL) { |
| 8729 | sds name = dictGetKey(de); |
| 8730 | struct RedisModule *module = dictGetVal(de); |
| 8731 | |
| 8732 | sds usedby = genModulesInfoStringRenderModulesList(module->usedby); |
| 8733 | sds using = genModulesInfoStringRenderModulesList(module->using); |
| 8734 | sds options = genModulesInfoStringRenderModuleOptions(module); |
| 8735 | info = sdscatfmt(info, |
| 8736 | "module:name=%S,ver=%i,api=%i,filters=%i," |
| 8737 | "usedby=%S,using=%S,options=%S\r\n", |
| 8738 | name, module->ver, module->apiver, |
| 8739 | (int)listLength(module->filters), usedby, using, options); |
| 8740 | sdsfree(usedby); |
| 8741 | sdsfree(using); |
| 8742 | sdsfree(options); |
| 8743 | } |
| 8744 | dictReleaseIterator(di); |
| 8745 | return info; |
| 8746 | } |
| 8747 | |
| 8748 | /* Redis MODULE command. |
| 8749 | * |
no test coverage detected