ipfs / go-ds-leveldb

An implementation of go-datastore using leveldb
MIT License
38 stars 21 forks source link

Fast reverse query #28

Closed Stebalien closed 5 years ago

Stebalien commented 5 years ago
  1. Make the reverse sorted query fast instead of falling back on the naive order.
  2. Always use the iterator-backed query adapter. Requires https://github.com/ipfs/go-datastore/pull/125 (tests won't pass without it).
Stebalien commented 5 years ago

@Stebalien makes sense. Basically, we are taking advantage of the fact that LevelDB will iterate in some order (we can define, but lexicographical by default) and that we can iterate over that data both forward and backward, and so we special case these two orderings.

Yep.

Is there any reason this PR is still marked as Draft? Just pending the go-datastore changes?

Yes. It panics otherwise as the current naive query adapters call Close concurrently with Next somewhere down the chain.