libpmemobj-cpp
libpmemobj-cpp copied to clipboard
Persistent container persistent iterators
FEAT: Persistent container iterators
Rationale
If we want program execution to be interruptable/restartable, we need to keep track of work in progress or be able to start from where we were interrupted. In this case, we need to persist the iterator's current place in the container at each change, but also have the usual iterator features that handle structure changes.
Description
How to create a persistent iterator that survives restarts?
API Changes
How to get back a given persistent iterator after a restart?
Could the iterator expose some data that the caller can obtain and store, and then be able to recreate the iterator using that data?
Should the iterator incrementation be part of an accessor transaction so we know the last piece of work against the container was done and we've moved onto the next item.
Implementation details
Would it be the responsibility of the iterator or the caller to handle the persistence and transaction?
Meta
A workaround is to go back to the old for (i=0; i < container.size(); i++) {} approach of container iteration (ie persisting i), but it has its drawbacks too (eg invalidation at structural change).
@pbalcer this goes back to a discussion we had via email back in December 2018 :-)
@pbalcer if this is too far out of scope lets close this?
@seghcder I don't think we will be able to implement this in foreseeable future. However, I think we can keep this open - we are always open to contributions and maybe someone will be interested in implementing this :)