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

Function CircularBuffer_ResetReader

src/util/circular_buffer.c:93–106  ·  view source on GitHub ↗

sets the read pointer to the beginning of the buffer

Source from the content-addressed store, hash-verified

91
92// sets the read pointer to the beginning of the buffer
93void CircularBuffer_ResetReader
94(
95 CircularBuffer cb // circular buffer
96) {
97 // compensate for circularity
98 uint64_t write = cb->write;
99 uint write_idx = write / cb->item_size;
100 int sub = write_idx - cb->item_count;
101 if(sub >= 0) {
102 cb->read = cb->data + (sub * cb->item_size);
103 } else {
104 cb->read = cb->end_marker + (sub * cb->item_size);
105 }
106}
107
108// adds an item to buffer
109// returns 1 on success, 0 otherwise

Callers 2

QueriesLog_FreeFunction · 0.85
_stream_queriesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected