ipfs / ipfs/go-datastore

No way to query past Query.Prefix?

Open
#116 31 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
247
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Hi gents!

Currently, `Query.Prefix` is used to do the initial seek when a `Query` begins, and iteration only continues while that prefix holds. There needs to be a flag that basically says, hey, don't use `Prefix` _once iteration has begun_. Otherwise, there's no way to effectively do a seek and do an arbitrary amount of scanning. This seems like a critical feature to leave behind, yikes.

Hopefully, I'm missing something!?

For example, in `go-ds-badger`: (line 270+)

```golang
it := txn.NewIterator(opt)
it.Seek(prefix)
...
qrb.Process.Go(func(worker goprocess.Process) {
...
for sent := 0; it.ValidForPrefix(prefix); sent++ {
...
}
}
...
```

could be enhanced to:

```golang
it := txn.NewIterator(opt)
it.Seek(prefix)
if q.PrefixOnlySeeks {
prefix = nil
}
...
```

Adding this would be easy, but all the impls would need to be updated of course. So maybe it's done as a selectively available feature?

This is a dealbreaker for us, but we love Datastore and want to use and support it! If some at PL agrees to accept our pull requests in a timely fashion, we'll help do the work. I'm sad we're now in this position, and would take less than a few mins for dbs like leveldb, badger, and bolt. What do y'all think?

We kindly need resolution on this relatively soon one way or the other so that we know we need to pass on Datastore.

Thanks,
Drew

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.