pmemkv icon indicating copy to clipboard operation
pmemkv copied to clipboard

FEAT: add is_prev() method in Iterators API

Open JanDorniak99 opened this issue 3 years ago • 0 comments

FEAT: add is_prev() method in Iterators API

Rationale

For now we have in documentation of prev():

If the previous record exists, returns pmem::kv::status::OK, otherwise pmem::kv::status::NOT_FOUND is returned and the iterator position is undefined.

So if we are on the first element we will be on the undefined position after calling prev(). With is_prev() method, we could avoid this.

Description

To solve this problem we can simply add is_prev() method to iterators that support prev() method.

But probably better option will be to change documentation to:

If the previous record exists, returns pmem::kv::status::OK, otherwise pmem::kv::status::NOT_FOUND is returned and the iterator position doesn't change.

Because in the current implementation position really doesn't change. It is only undefined by documentation.

API Changes

add is_prev() method to iterators or change prev() documentation

JanDorniak99 avatar Jan 21 '21 08:01 JanDorniak99