mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Add a few comments to streamIteratorRemoveEntry().
This commit is contained in:
parent
a317f55d25
commit
103c5a1a3c
@ -705,10 +705,14 @@ void streamIteratorRemoveEntry(streamIterator *si, streamID *current) {
|
|||||||
/* Change the valid/deleted entries count in the master entry. */
|
/* Change the valid/deleted entries count in the master entry. */
|
||||||
unsigned char *p = lpFirst(lp);
|
unsigned char *p = lpFirst(lp);
|
||||||
aux = lpGetInteger(p);
|
aux = lpGetInteger(p);
|
||||||
|
|
||||||
if (aux == 1) {
|
if (aux == 1) {
|
||||||
|
/* If this is the last element in the listpack, we can remove the whole
|
||||||
|
* node. */
|
||||||
lpFree(lp);
|
lpFree(lp);
|
||||||
raxRemove(si->stream->rax,si->ri.key,si->ri.key_len,NULL);
|
raxRemove(si->stream->rax,si->ri.key,si->ri.key_len,NULL);
|
||||||
} else {
|
} else {
|
||||||
|
/* In the base case we alter the counters of valid/deleted entries. */
|
||||||
lp = lpReplaceInteger(lp,&p,aux-1);
|
lp = lpReplaceInteger(lp,&p,aux-1);
|
||||||
p = lpNext(lp,p); /* Seek deleted field. */
|
p = lpNext(lp,p); /* Seek deleted field. */
|
||||||
aux = lpGetInteger(p);
|
aux = lpGetInteger(p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user