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

Function rioWriteStreamEmptyConsumer

src/aof.cpp:1372–1381  ·  view source on GitHub ↗

Helper for rewriteStreamObject(): emit the XGROUP CREATECONSUMER is * needed in order to create consumers that do not have any pending entries. * All this in the context of the specified key and group. */

Source from the content-addressed store, hash-verified

1370 * needed in order to create consumers that do not have any pending entries.
1371 * All this in the context of the specified key and group. */
1372int rioWriteStreamEmptyConsumer(rio *r, robj *key, const char *groupname, size_t groupname_len, streamConsumer *consumer) {
1373 /* XGROUP CREATECONSUMER <key> <group> <consumer> */
1374 if (rioWriteBulkCount(r,'*',5) == 0) return 0;
1375 if (rioWriteBulkString(r,"XGROUP",6) == 0) return 0;
1376 if (rioWriteBulkString(r,"CREATECONSUMER",14) == 0) return 0;
1377 if (rioWriteBulkObject(r,key) == 0) return 0;
1378 if (rioWriteBulkString(r,groupname,groupname_len) == 0) return 0;
1379 if (rioWriteBulkString(r,consumer->name,sdslen(consumer->name)) == 0) return 0;
1380 return 1;
1381}
1382
1383/* Emit the commands needed to rebuild a stream object.
1384 * The function returns 0 on error, 1 on success. */

Callers 1

rewriteStreamObjectFunction · 0.85

Calls 4

rioWriteBulkCountFunction · 0.85
rioWriteBulkStringFunction · 0.85
rioWriteBulkObjectFunction · 0.85
sdslenFunction · 0.85

Tested by

no test coverage detected