MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / DataBlockIterator_Next

Function DataBlockIterator_Next

src/util/datablock/datablock_iterator.c:33–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void *DataBlockIterator_Next
34(
35 DataBlockIterator *iter,
36 uint64_t *id
37) {
38 ASSERT(iter != NULL);
39
40 // set default
41 void *item = NULL;
42 DataBlockItemHeader *item_header = NULL;
43
44 // have we reached the end of our iterator?
45 while(iter->_current_pos < iter->_end_pos && iter->_current_block != NULL) {
46 // get item at current position
47 Block *block = iter->_current_block;
48 item_header = (DataBlockItemHeader *)block->data + (iter->_block_pos * block->itemSize);
49
50 // advance to next position
51 iter->_block_pos += 1;
52 iter->_current_pos += 1;
53
54 // advance to next block if current block consumed
55 if(iter->_block_pos == iter->_block_cap) {
56 iter->_block_pos = 0;
57 iter->_current_block = iter->_current_block->next;
58 }
59
60 if(!IS_ITEM_DELETED(item_header)) {
61 item = ITEM_DATA(item_header);
62 if(id) *id = iter->_current_pos - 1;
63 break;
64 }
65 }
66
67 return item;
68}
69
70void DataBlockIterator_Reset
71(

Callers 8

UndoLog_FreeFunction · 0.85
RdbSaveNodes_v13Function · 0.85
_Graph_FreeFunction · 0.85
AllNodeScanConsumeFunction · 0.85
test_dataBlockScanFunction · 0.85
test_dataBlockRemoveItemFunction · 0.85

Calls

no outgoing calls

Tested by 3

test_dataBlockScanFunction · 0.68
test_dataBlockRemoveItemFunction · 0.68