n0-computer / n0-computer/noq

Emit events when new CIDs are available

Open
#754 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API
Dominant language
Rust
Stars
413
Forks
63
Avg merge
4d 14m
Merged PRs (30d)
4

Description

Connection::open_path can fails if there are no remove CIDs for the path. There is nothing the application can do about this, it normally resolves itself after a little while once CIDs arrive.

However the application is never told when new CIDs are available. Iroh currently works around this by waiting some arbitrary (long) time before trying again, which is not ideal.

If we added a PathEvent::NewCids { path_id: PathId } then it would be possible for the application to react and try again.


One challenge is that new CIDs often come in batches, but that the application only needs the event once per batch. This problem already exists with the events emitted by Connection::nat_traversal_updates. Another issue with the batches is that the events queue is bounded, so if a lot of new CIDs arrive other events in the queue will be pushed out. So it is kind of important to debounce on the emitting side. Or maybe events are the wrong mechanism for this entirely.

A watcher-style API might be an option. But needing to have each path ID means it needs to be a set or similar, and collections are not very suitable for watchers. If it is a watcher it might have to be expressed as the set of all paths which currently have CIDs, or something similar.

Contributor guide

Open the 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.

Research direction

Start by reading Connection::open_path and the existing PathEvent handling, then compare the batching behavior of Connection::nat_traversal_updates and the bounded events queue. Determine whether a debounced NewCids event or watcher-style API fits better. Done means applications can react when CIDs arrive for a path without repeated events or displacing unrelated queued events.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.