MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / streamParseIntervalIDOrReply

Function streamParseIntervalIDOrReply

src/t_stream.cpp:1749–1764  ·  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

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

Callers 3

xrangeGenericCommandFunction · 0.85
xpendingCommandFunction · 0.85
xautoclaimCommandFunction · 0.85

Calls 6

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

Tested by

no test coverage detected