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

Function streamCreateCG

app/redis-6.2.6/src/t_stream.c:2267–2278  ·  view source on GitHub ↗

Create a new consumer group in the context of the stream 's', having the * specified name and last server ID. If a consumer group with the same name * already existed NULL is returned, otherwise the pointer to the consumer * group is returned. */

Source from the content-addressed store, hash-verified

2265 * already existed NULL is returned, otherwise the pointer to the consumer
2266 * group is returned. */
2267streamCG *streamCreateCG(stream *s, char *name, size_t namelen, streamID *id) {
2268 if (s->cgroups == NULL) s->cgroups = raxNew();
2269 if (raxFind(s->cgroups,(unsigned char*)name,namelen) != raxNotFound)
2270 return NULL;
2271
2272 streamCG *cg = zmalloc(sizeof(*cg));
2273 cg->pel = raxNew();
2274 cg->consumers = raxNew();
2275 cg->last_id = *id;
2276 raxInsert(s->cgroups,(unsigned char*)name,namelen,cg,NULL);
2277 return cg;
2278}
2279
2280/* Free a consumer group and all its associated data. */
2281void streamFreeCG(streamCG *cg) {

Callers 3

rdbLoadObjectFunction · 0.85
streamDupFunction · 0.85
xgroupCommandFunction · 0.85

Calls 4

raxNewFunction · 0.85
raxFindFunction · 0.85
zmallocFunction · 0.85
raxInsertFunction · 0.85

Tested by

no test coverage detected