n0-computer / n0-computer/iroh-docs

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.

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

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

Contributor guide

No contributing guide indexed for this repository

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.