MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rioWriteStreamEmptyConsumer

Function rioWriteStreamEmptyConsumer

app/redis-6.2.6/src/aof.c:1273–1282  ·  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

1271 * needed in order to create consumers that do not have any pending entries.
1272 * All this in the context of the specified key and group. */
1273int rioWriteStreamEmptyConsumer(rio *r, robj *key, const char *groupname, size_t groupname_len, streamConsumer *consumer) {
1274 /* XGROUP CREATECONSUMER <key> <group> <consumer> */
1275 if (rioWriteBulkCount(r,'*',5) == 0) return 0;
1276 if (rioWriteBulkString(r,"XGROUP",6) == 0) return 0;
1277 if (rioWriteBulkString(r,"CREATECONSUMER",14) == 0) return 0;
1278 if (rioWriteBulkObject(r,key) == 0) return 0;
1279 if (rioWriteBulkString(r,groupname,groupname_len) == 0) return 0;
1280 if (rioWriteBulkString(r,consumer->name,sdslen(consumer->name)) == 0) return 0;
1281 return 1;
1282}
1283
1284/* Emit the commands needed to rebuild a stream object.
1285 * 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