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

Function moduleTypeDupOrReply

src/module.cpp:4490–4503  ·  view source on GitHub ↗

Create a copy of a module type value using the copy callback. If failed * or not supported, produce an error reply and return NULL. */

Source from the content-addressed store, hash-verified

4488 * or not supported, produce an error reply and return NULL.
4489 */
4490robj *moduleTypeDupOrReply(client *c, robj *fromkey, robj *tokey, robj *value) {
4491 moduleValue *mv = (moduleValue*)ptrFromObj(value);
4492 moduleType *mt = mv->type;
4493 if (!mt->copy) {
4494 addReplyError(c, "not supported for this module key");
4495 return NULL;
4496 }
4497 void *newval = mt->copy(fromkey, tokey, mv->value);
4498 if (!newval) {
4499 addReplyError(c, "module key failed to copy");
4500 return NULL;
4501 }
4502 return createModuleObject(mt, newval);
4503}
4504
4505/* Register a new data type exported by the module. The parameters are the
4506 * following. Please for in depth documentation check the modules API

Callers 1

copyCommandFunction · 0.85

Calls 4

ptrFromObjFunction · 0.85
addReplyErrorFunction · 0.85
createModuleObjectFunction · 0.85
copyMethod · 0.80

Tested by

no test coverage detected