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

Function streamParseIntervalIDOrReply

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

Helper for parsing a stream ID that is a range query interval. When the * exclude argument is NULL, streamParseIDOrReply() is called and the interval * is treated as close (inclusive). Otherwise, the exclude argument is set if * the interval is open (the "(" prefix) and streamParseStrictIDOrReply() is * called in that case. */

Source from the content-addressed store, hash-verified

1745 * called in that case.
1746 */
1747int streamParseIntervalIDOrReply(client *c, robj *o, streamID *id, int *exclude, uint64_t missing_seq) {
1748 char *p = o->ptr;
1749 size_t len = sdslen(p);
1750 int invalid = 0;
1751
1752 if (exclude != NULL) *exclude = (len > 1 && p[0] == '(');
1753 if (exclude != NULL && *exclude) {
1754 robj *t = createStringObject(p+1,len-1);
1755 invalid = (streamParseStrictIDOrReply(c,t,id,missing_seq) == C_ERR);
1756 decrRefCount(t);
1757 } else
1758 invalid = (streamParseIDOrReply(c,o,id,missing_seq) == C_ERR);
1759 if (invalid)
1760 return C_ERR;
1761 return C_OK;
1762}
1763
1764void streamRewriteApproxSpecifier(client *c, int idx) {
1765 rewriteClientCommandArgument(c,idx,shared.special_equals);

Callers 3

xrangeGenericCommandFunction · 0.85
xpendingCommandFunction · 0.85
xautoclaimCommandFunction · 0.85

Calls 5

sdslenFunction · 0.85
decrRefCountFunction · 0.85
streamParseIDOrReplyFunction · 0.85
createStringObjectFunction · 0.70

Tested by

no test coverage detected