n0-computer / n0-computer/iroh-docs
Document importing should a minimal amount of work if the document already exists
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 74
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
This is sort-of the document equivalent of https://github.com/n0-computer/iroh/issues/1947. If RPC calls to import the same document are made in quick succession (as happens with https://github.com/expenses/usd-iroh-resolver), the RPC calls will eventually stall out (unless a timeout is used) and the iroh node will produce a bunch of sync and gossip warnings:
2024-02-02T03:44:28.897392Z WARN gossip{me=5edsipymvbm2kl2y}: iroh_gossip::net: dial failed: failed connecting to provider peer=PublicKey(7siesmyj2xdrlsti)
2024-02-02T03:44:28.897519Z WARN sync{me=5edsipymvbm2kl2y}: iroh::sync_engine::live: sync failed origin=Connect(DirectJoin) err=Failed to establish connection
Caused by:
0: failed connecting to provider
1: timed out
I managed to work around whatever issue is happening with iroh by checking if the document to import exists locally first:
if let Some(doc) = iroh.docs.open(ticket.capability.id()).await? {
return Ok(doc);
}
iroh.docs.import(ticket.clone()).await
This will not produce the expected behaviour if the ticket contains the addresses of nodes that aren't currently being synced with, as these will not be sent to the iroh node.
Ideally iroh.docs.import should perform the same actions as iroh.docs.open if the document already exists and there are no new node addresses, and if there are new nodes, should join these in the background while returning the document the same was as iroh.docs.open.
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 comparing the behavior of iroh.docs.open and iroh.docs.import, using the repeated-import scenario and iroh issue 1947 for context. Check how existing documents and ticket node addresses are handled. Done means repeated imports return promptly like open while still incorporating new node addresses in the background.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100