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

Function catAppendOnlyGenericCommand

src/aof.cpp:568–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566}
567
568sds catAppendOnlyGenericCommand(sds dst, int argc, robj **argv) {
569 char buf[32];
570 int len, j;
571 robj *o;
572
573 buf[0] = '*';
574 len = 1+ll2string(buf+1,sizeof(buf)-1,argc);
575 buf[len++] = '\r';
576 buf[len++] = '\n';
577 dst = sdscatlen(dst,buf,len);
578
579 for (j = 0; j < argc; j++) {
580 if (sdsEncodedObject(argv[j]))
581 o = argv[j];
582 else
583 o = getDecodedObject(argv[j]);
584 buf[0] = '$';
585 len = 1+ll2string(buf+1,sizeof(buf)-1,sdslen(szFromObj(o)));
586 buf[len++] = '\r';
587 buf[len++] = '\n';
588 dst = sdscatlen(dst,buf,len);
589 dst = sdscatlen(dst,ptrFromObj(o),sdslen(szFromObj(o)));
590 dst = sdscatlen(dst,"\r\n",2);
591 if (o != argv[j])
592 decrRefCount(o);
593 }
594 return dst;
595}
596
597/* Create the sds representation of a PEXPIREAT command, using
598 * 'seconds' as time to live and 'cmd' to understand what command

Calls 7

ll2stringFunction · 0.85
sdscatlenFunction · 0.85
getDecodedObjectFunction · 0.85
sdslenFunction · 0.85
szFromObjFunction · 0.85
ptrFromObjFunction · 0.85
decrRefCountFunction · 0.85

Tested by

no test coverage detected