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

Function moduleLoadString

src/module.cpp:4845–4860  ·  view source on GitHub ↗

Implements RM_LoadString() and RM_LoadStringBuffer() */

Source from the content-addressed store, hash-verified

4843
4844/* Implements RM_LoadString() and RM_LoadStringBuffer() */
4845void *moduleLoadString(RedisModuleIO *io, int plain, size_t *lenptr) {
4846 void *s = nullptr;
4847 if (io->error) return NULL;
4848 if (io->ver == 2) {
4849 uint64_t opcode = rdbLoadLen(io->prio,NULL);
4850 if (opcode != RDB_MODULE_OPCODE_STRING) goto loaderr;
4851 }
4852 s = rdbGenericLoadStringObject(io->prio,
4853 plain ? RDB_LOAD_PLAIN : RDB_LOAD_NONE, lenptr);
4854 if (s == NULL) goto loaderr;
4855 return s;
4856
4857loaderr:
4858 moduleRDBLoadError(io);
4859 return NULL;
4860}
4861
4862/* In the context of the rdb_load method of a module data type, loads a string
4863 * from the RDB file, that was previously saved with RedisModule_SaveString()

Callers 2

RM_LoadStringFunction · 0.85
RM_LoadStringBufferFunction · 0.85

Calls 3

rdbLoadLenFunction · 0.85
moduleRDBLoadErrorFunction · 0.85

Tested by

no test coverage detected