classic-level icon indicating copy to clipboard operation
classic-level copied to clipboard

Support abort signal in iterator.all()

Open ronag opened this issue 3 years ago • 2 comments

Currently there is no good way to abort a iterator.all() call. Would be nice if the api could support AbortController.

ronag avatar Apr 01 '22 07:04 ronag

If your all() call is a long-running operation (getting many entries) it might not be the best method to use. For that same reason, all() currently uses nextv() under the hood, rather than a dedicated and optimized C++ method for all(). Because I assumed that the iterator typically just needs a few nextv() calls to get all entries. That does give us a way to abort, in between nextv() calls, but I'm not sure that fits your use case.

Assuming that we did have such a dedicated method, let's say iterator_all() - how would we cancel the async work in C++?

vweevers avatar Apr 03 '22 00:04 vweevers

https://github.com/Level/abstract-level/pull/55 (as noted there, implementations have to handle the aborting, so there will be additional work here).

vweevers avatar Nov 14 '22 21:11 vweevers