MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / moduleTypeLookupModuleByName

Function moduleTypeLookupModuleByName

src/module.cpp:4396–4416  ·  view source on GitHub ↗

Search, in the list of exported data types of all the modules registered, * a type with the same name as the one given. Returns the moduleType * structure pointer if such a module is found, or NULL otherwise. */

Source from the content-addressed store, hash-verified

4394 * a type with the same name as the one given. Returns the moduleType
4395 * structure pointer if such a module is found, or NULL otherwise. */
4396moduleType *moduleTypeLookupModuleByName(const char *name) {
4397 dictIterator *di = dictGetIterator(modules);
4398 dictEntry *de;
4399
4400 while ((de = dictNext(di)) != NULL) {
4401 struct RedisModule *module = (RedisModule*)dictGetVal(de);
4402 listIter li;
4403 listNode *ln;
4404
4405 listRewind(module->types,&li);
4406 while((ln = listNext(&li))) {
4407 moduleType *mt = (moduleType*)ln->value;
4408 if (memcmp(name,mt->name,sizeof(mt->name)) == 0) {
4409 dictReleaseIterator(di);
4410 return mt;
4411 }
4412 }
4413 }
4414 dictReleaseIterator(di);
4415 return NULL;
4416}
4417
4418/* Lookup a module by ID, with caching. This function is used during RDB
4419 * loading. Modules exporting data types should never be able to unload, so

Callers 1

RM_CreateDataTypeFunction · 0.85

Calls 5

listRewindFunction · 0.85
listNextFunction · 0.85
dictGetIteratorFunction · 0.70
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected