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

Function streamIteratorGetField

src/t_stream.cpp:1236–1246  ·  view source on GitHub ↗

Get the field and value of the current item we are iterating. This should * be called immediately after streamIteratorGetID(), and for each field * according to the number of fields returned by streamIteratorGetID(). * The function populates the field and value pointers and the corresponding * lengths by reference, that are valid until the next iterator call, assuming * no one touches the str

Source from the content-addressed store, hash-verified

1234 * lengths by reference, that are valid until the next iterator call, assuming
1235 * no one touches the stream meanwhile. */
1236void streamIteratorGetField(streamIterator *si, unsigned char **fieldptr, unsigned char **valueptr, int64_t *fieldlen, int64_t *valuelen) {
1237 if (si->entry_flags & STREAM_ITEM_FLAG_SAMEFIELDS) {
1238 *fieldptr = lpGet(si->master_fields_ptr,fieldlen,si->field_buf);
1239 si->master_fields_ptr = lpNext(si->lp,si->master_fields_ptr);
1240 } else {
1241 *fieldptr = lpGet(si->lp_ele,fieldlen,si->field_buf);
1242 si->lp_ele = lpNext(si->lp,si->lp_ele);
1243 }
1244 *valueptr = lpGet(si->lp_ele,valuelen,si->value_buf);
1245 si->lp_ele = lpNext(si->lp,si->lp_ele);
1246}
1247
1248/* Remove the current entry from the stream: can be called after the
1249 * GetID() API or after any GetField() call, however we need to iterate

Callers 4

streamReplyWithRangeFunction · 0.85
xorObjectDigestFunction · 0.85
rewriteStreamObjectFunction · 0.85

Calls 2

lpGetFunction · 0.85
lpNextFunction · 0.85

Tested by

no test coverage detected