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

Function xpendingCommand

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

XPENDING [[IDLE ] [ ]] * * If start and stop are omitted, the command just outputs information about * the amount of pending messages for the key/group pair, together with * the minimum and maximum ID of pending messages. * * If start and stop are provided instead, the pending messages are returned * with information about the current owne

Source from the content-addressed store, hash-verified

2599 * with information about the current owner, number of deliveries and last
2600 * delivery time and so forth. */
2601void xpendingCommand(client *c) {
2602 int justinfo = c->argc == 3; /* Without the range just outputs general
2603 informations about the PEL. */
2604 robj *key = c->argv[1];
2605 robj *groupname = c->argv[2];
2606 robj *consumername = NULL;
2607 streamID startid, endid;
2608 long long count = 0;
2609 long long minidle = 0;
2610 int startex = 0, endex = 0;
2611
2612 /* Start and stop, and the consumer, can be omitted. Also the IDLE modifier. */
2613 if (c->argc != 3 && (c->argc < 6 || c->argc > 9)) {
2614 addReplyErrorObject(c,shared.syntaxerr);
2615 return;
2616 }
2617
2618 /* Parse start/end/count arguments ASAP if needed, in order to report
2619 * syntax errors before any other error. */
2620 if (c->argc >= 6) {
2621 int startidx = 3; /* Without IDLE */
2622
2623 if (!strcasecmp(c->argv[3]->ptr, "IDLE")) {
2624 if (getLongLongFromObjectOrReply(c, c->argv[4], &minidle, NULL) == C_ERR)
2625 return;
2626 if (c->argc < 8) {
2627 /* If IDLE was provided we must have at least 'start end count' */
2628 addReplyErrorObject(c,shared.syntaxerr);
2629 return;
2630 }
2631 /* Search for rest of arguments after 'IDLE <idle>' */
2632 startidx += 2;
2633 }
2634
2635 /* count argument. */
2636 if (getLongLongFromObjectOrReply(c,c->argv[startidx+2],&count,NULL) == C_ERR)
2637 return;
2638 if (count < 0) count = 0;
2639
2640 /* start and end arguments. */
2641 if (streamParseIntervalIDOrReply(c,c->argv[startidx],&startid,&startex,0) != C_OK)
2642 return;
2643 if (startex && streamIncrID(&startid) != C_OK) {
2644 addReplyError(c,"invalid start ID for the interval");
2645 return;
2646 }
2647 if (streamParseIntervalIDOrReply(c,c->argv[startidx+1],&endid,&endex,UINT64_MAX) != C_OK)
2648 return;
2649 if (endex && streamDecrID(&endid) != C_OK) {
2650 addReplyError(c,"invalid end ID for the interval");
2651 return;
2652 }
2653
2654 if (startidx+3 < c->argc) {
2655 /* 'consumer' was provided */
2656 consumername = c->argv[startidx+3];
2657 }
2658 }

Callers

nothing calls this directly

Calls 15

addReplyErrorObjectFunction · 0.85
strcasecmpFunction · 0.85
streamIncrIDFunction · 0.85
addReplyErrorFunction · 0.85
streamDecrIDFunction · 0.85
lookupKeyReadFunction · 0.85
checkTypeFunction · 0.85
streamLookupCGFunction · 0.85
addReplyErrorFormatFunction · 0.85
addReplyArrayLenFunction · 0.85

Tested by

no test coverage detected