n0-computer / n0-computer/iroh-docs
Query: support cursor-based prefix iteration (key_prefix_from)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 74
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Problem
get_many with key_prefix always starts scanning from the beginning of the prefix. For applications that maintain a cursor (e.g., iterating over an event log from the last processed position), this forces O(n) client-side skipping via offset.
Proposed solution
Add a from: Option<Bytes> field to Query and a key_prefix_from(prefix, cursor) method on QueryBuilder. When using SortBy::KeyAuthor, the B-tree lower bound is set to the cursor position instead of the prefix start — O(log n) seek.
PR
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating Query and QueryBuilder, then trace get_many, key_prefix, offset, and SortBy::KeyAuthor to understand the current prefix scan. Implement the cursor-based lower-bound behavior described in the issue and verify that key_prefix_from seeks from the cursor instead of client-side skipping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100