Level / abstract-leveldown

An abstract prototype matching the leveldown API.
MIT License
146 stars 53 forks source link

Async _open for AbstractIterator #233

Closed andrewosh closed 6 years ago

andrewosh commented 6 years ago

Hey all,

I'm running into an issue with snapshotting on iterator creation: the underlying storage I'm using requires an asynchronous version computation in order to create a snapshot, but currently AbstractIterator assumes snapshotting is always synchronous.

It seems like this would be supported by most iterator implementations, but perhaps the level interface puts a fundamental constraint on this. Any thoughts on possible approaches?

vweevers commented 6 years ago

If it's asynchronous, it would need some other mechanism (locks?) to guarantee that reads are unaffected by simultaneous writes.

But I think it's fine for an implementation not to support snapshots. There is an open plan to isolate the snapshot tests so that they can be skipped, and to add tests for implementations that only partially support snapshots: https://github.com/Level/abstract-leveldown/issues/165.

andrewosh commented 6 years ago

Ah excellent, didn't know about #165. Yeah I see the complexity there -- I'll skip the snapshotting for now and omit the snapshot tests locally until that PR lands.

Thanks for the quick reply!

vweevers commented 6 years ago

@andrewosh The snapshot tests can be skipped since 6.0.0. See the upgrade guide and the new test suite documentation.