n0-computer / n0-computer/iroh-docs
[Rust] How to store and reuse `Doc<>` struct in my application?
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 74
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Overview:
- The README.md example snippets shows how to create a
Docs<Store>struct in rust
let docs: Docs<Store> = Docs::memory().spawn(&blobs, &gossip).await?;
- However, when I create a client, and a document, the rust types for these structs are complex, part of it is even private i.e.
quic-rpc/Connection
let docs_client = docs.client();
let doc = docs_client.create().await?;
I'm running into the following issue:
- It is not clear, what is the intended lifecycle of these structs.
- Should I save the instance and passing them around my applications's struct/function to implement my logic? (Complicated typing leads to compiler headaches)
- Or treat them as one-off instance, and instead clone the
Docs<Store>struct &NamespaceID, then uses it to spawn in the document client when ever needed. (Seems to not be ideal, performance wise)
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 with the README.md Rust example using Docs::memory().spawn, then inspect the docs.client() and create() entry points mentioned in the issue. Clarify the intended lifecycle and reusable application-facing types for Docs, the client, and NamespaceID, and document the guidance in the README.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100