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

Function streamIncrID

src/t_stream.cpp:94–109  ·  view source on GitHub ↗

Set 'id' to be its successor stream ID. * If 'id' is the maximal possible id, it is wrapped around to 0-0 and a * C_ERR is returned. */

Source from the content-addressed store, hash-verified

92 * If 'id' is the maximal possible id, it is wrapped around to 0-0 and a
93 * C_ERR is returned. */
94int streamIncrID(streamID *id) {
95 int ret = C_OK;
96 if (id->seq == UINT64_MAX) {
97 if (id->ms == UINT64_MAX) {
98 /* Special case where 'id' is the last possible streamID... */
99 id->ms = id->seq = 0;
100 ret = C_ERR;
101 } else {
102 id->ms++;
103 id->seq = 0;
104 }
105 } else {
106 id->seq++;
107 }
108 return ret;
109}
110
111/* Set 'id' to be its predecessor stream ID.
112 * If 'id' is the minimal possible id, it remains 0-0 and a C_ERR is

Callers 7

streamNextIDFunction · 0.85
xrangeGenericCommandFunction · 0.85
xreadCommandFunction · 0.85
xpendingCommandFunction · 0.85
xautoclaimCommandFunction · 0.85
RM_StreamIteratorStartFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected