pmem / pmemstream

Other
9 stars 13 forks source link

Change entry_iterator behavior #105

Closed igchor closed 2 years ago

igchor commented 2 years ago

FEAT: Change entry_iterator behavior

Rationale

Right now, when pmemstream_entry_iterator_next is called and there are no more entries user-provided offset will be set to after the last entry. This is problematic if a user wants to get the last entry from the region. They can't just do:

    struct pmemstream_entry last_entry;
    while (pmemstream_entry_iterator_next(eiter, nullptr, &last_entry) == 0) {      
        }

Becasue after pmemstream_entry_iterator_next returns -1, last_entry will be invalid.

Change this behavior to not modify offset when there are no more elements.

API Changes

None