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

Function streamLookupConsumer

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

Lookup the consumer with the specified name in the group 'cg': if the * consumer does not exist it is created unless SLC_NOCREAT flag was specified. * Its last seen time is updated unless SLC_NOREFRESH flag was specified. */

Source from the content-addressed store, hash-verified

2297 * consumer does not exist it is created unless SLC_NOCREAT flag was specified.
2298 * Its last seen time is updated unless SLC_NOREFRESH flag was specified. */
2299streamConsumer *streamLookupConsumer(streamCG *cg, sds name, int flags, int *created) {
2300 if (created) *created = 0;
2301 int create = !(flags & SLC_NOCREAT);
2302 int refresh = !(flags & SLC_NOREFRESH);
2303 streamConsumer *consumer = raxFind(cg->consumers,(unsigned char*)name,
2304 sdslen(name));
2305 if (consumer == raxNotFound) {
2306 if (!create) return NULL;
2307 consumer = zmalloc(sizeof(*consumer));
2308 consumer->name = sdsdup(name);
2309 consumer->pel = raxNew();
2310 raxInsert(cg->consumers,(unsigned char*)name,sdslen(name),
2311 consumer,NULL);
2312 consumer->seen_time = mstime();
2313 if (created) *created = 1;
2314 } else if (refresh)
2315 consumer->seen_time = mstime();
2316 return consumer;
2317}
2318
2319/* Delete the consumer specified in the consumer group 'cg'. The consumer
2320 * may have pending messages: they are removed from the PEL, and the number

Callers 8

rdbLoadObjectFunction · 0.85
xreadCommandFunction · 0.85
streamDelConsumerFunction · 0.85
xgroupCommandFunction · 0.85
xpendingCommandFunction · 0.85
xclaimCommandFunction · 0.85
xautoclaimCommandFunction · 0.85

Calls 7

raxFindFunction · 0.85
sdslenFunction · 0.85
zmallocFunction · 0.85
sdsdupFunction · 0.85
raxNewFunction · 0.85
raxInsertFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected