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

Function streamTypeLookupWriteOrCreate

src/t_stream.cpp:1662–1674  ·  view source on GitHub ↗

Look the stream at 'key' and return the corresponding stream object. * The function creates a key setting it to an empty stream if needed. */

Source from the content-addressed store, hash-verified

1660/* Look the stream at 'key' and return the corresponding stream object.
1661 * The function creates a key setting it to an empty stream if needed. */
1662robj *streamTypeLookupWriteOrCreate(client *c, robj *key, int no_create) {
1663 robj *o = lookupKeyWrite(c->db,key);
1664 if (checkType(c,o,OBJ_STREAM)) return NULL;
1665 if (o == NULL) {
1666 if (no_create) {
1667 addReplyNull(c);
1668 return NULL;
1669 }
1670 o = createStreamObject();
1671 dbAdd(c->db,key,o);
1672 }
1673 return o;
1674}
1675
1676/* Parse a stream ID in the format given by clients to Redis, that is
1677 * <ms>-<seq>, and converts it into a streamID structure. If

Callers 1

xaddCommandFunction · 0.85

Calls 5

lookupKeyWriteFunction · 0.85
checkTypeFunction · 0.85
addReplyNullFunction · 0.85
createStreamObjectFunction · 0.85
dbAddFunction · 0.85

Tested by

no test coverage detected