Query: support cursor-based prefix iteration (key_prefix_from)

Open
#109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
databases

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.

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

https://github.com/n0-computer/iroh-docs/pull/108

Dominant language
Rust
Stars
81
Forks
19
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from n0-computer/iroh-docs

All issues in n0-computer/iroh-docs

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.