{"id":21038680,"url":"https://github.com/n0-computer/iroh-docs","last_synced_at":"2025-05-15T16:31:21.493Z","repository":{"id":260090446,"uuid":"877234872","full_name":"n0-computer/iroh-docs","owner":"n0-computer","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-06T12:21:53.000Z","size":7248,"stargazers_count":18,"open_issues_count":9,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-06T13:28:59.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n0-computer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-23T10:14:37.000Z","updated_at":"2025-04-29T09:54:23.000Z","dependencies_parsed_at":"2024-11-14T14:29:40.744Z","dependency_job_id":"d84bb325-6e67-440a-ad2d-6b5b37edfb96","html_url":"https://github.com/n0-computer/iroh-docs","commit_stats":null,"previous_names":["n0-computer/iroh-docs"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n0-computer%2Firoh-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n0-computer%2Firoh-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n0-computer%2Firoh-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n0-computer%2Firoh-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n0-computer","download_url":"https://codeload.github.com/n0-computer/iroh-docs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253830956,"owners_count":21971004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T13:34:11.442Z","updated_at":"2025-05-15T16:31:21.472Z","avatar_url":"https://github.com/n0-computer.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iroh-docs\n\nMulti-dimensional key-value documents with an efficient synchronization protocol.\n\nThe crate operates on *Replicas*. A replica contains an unlimited number of\n*Entries*. Each entry is identified by a key, its author, and the replica's\nnamespace. Its value is the 32-byte BLAKE3 hash of the entry's content data,\nthe size of this content data, and a timestamp.\nThe content data itself is not stored or transferred through a replica.\n\nAll entries in a replica are signed with two keypairs:\n\n* The *Namespace* key, as a token of write capability. The public key is the *NamespaceId*, which\n  also serves as the unique identifier for a replica.\n* The *Author* key, as a proof of authorship. Any number of authors may be created, and\n  their semantic meaning is application-specific. The public key of an author is the [AuthorId].\n\nReplicas can be synchronized between peers by exchanging messages. The synchronization algorithm\nis based on a technique called *range-based set reconciliation*, based on [this paper][paper] by\nAljoscha Meyer:\n\n\u003e Range-based set reconciliation is a simple approach to efficiently compute the union of two\nsets over a network, based on recursively partitioning the sets and comparing fingerprints of\nthe partitions to probabilistically detect whether a partition requires further work.\n\nThe crate exposes a generic storage interface with in-memory and persistent, file-based\nimplementations. The latter makes use of [`redb`], an embedded key-value store, and persists\nthe whole store with all replicas to a single file.\n\n[paper]: https://arxiv.org/abs/2212.13567\n\n# Getting Started\n\nThe entry into the `iroh-docs` protocol is the `Docs` struct, which uses an [`Engine`](https://docs.rs/iroh-docs/latest/iroh_docs/engine/struct.Engine.html) to power the protocol.\n\n`Docs` was designed to be used in conjunction with `iroh`. [Iroh](https://docs.rs/iroh) is a networking library for making direct connections, these connections are peers send sync messages and transfer data.\n\nIroh provides a [`Router`](https://docs.rs/iroh/latest/iroh/protocol/struct.Router.html) that takes an [`Endpoint`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Endpoint.html) and any protocols needed for the application. Similar to a router in webserver library, it runs a loop accepting incoming connections and routes them to the specific protocol handler, based on `ALPN`.\n\n`Docs` is a \"meta protocol\" that relies on the [`iroh-blobs`](https://docs.rs/iroh-blobs) and [`iroh-gossip`](https://docs.rs/iroh-gossip) protocols. Setting up `Docs` will require setting up `Blobs` and `Gossip` as well.\n\nHere is a basic example of how to set up `iroh-docs` with `iroh`:\n\n```rust\nuse iroh::{protocol::Router, Endpoint};\nuse iroh_blobs::{net_protocol::Blobs, util::local_pool::LocalPool, ALPN as BLOBS_ALPN};\nuse iroh_docs::{protocol::Docs, ALPN as DOCS_ALPN};\nuse iroh_gossip::{net::Gossip, ALPN as GOSSIP_ALPN};\n\n#[tokio::main]\nasync fn main() -\u003e anyhow::Result\u003c()\u003e {\n    // create an iroh endpoint that includes the standard discovery mechanisms\n    // we've built at number0\n    let endpoint = Endpoint::builder().discovery_n0().bind().await?;\n\n    // create a router builder, we will add the\n    // protocols to this builder and then spawn\n    // the router\n    let builder = Router::builder(endpoint);\n\n    // build the blobs protocol\n    let blobs = Blobs::memory().build(builder.endpoint());\n\n    // build the gossip protocol\n    let gossip = Gossip::builder().spawn(builder.endpoint().clone()).await?;\n\n    // build the docs protocol\n    let docs = Docs::memory().spawn(\u0026blobs, \u0026gossip).await?;\n\n    // setup router\n    let router = builder\n        .accept(BLOBS_ALPN, blobs)\n        .accept(GOSSIP_ALPN, gossip)\n        .accept(DOCS_ALPN, docs)\n        .spawn();\n\n    // do fun stuff with docs!\n    Ok(())\n}\n```\n\n# License\n\nThis project is licensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n   \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n   \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this project by you, as defined in the Apache-2.0 license,\nshall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn0-computer%2Firoh-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn0-computer%2Firoh-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn0-computer%2Firoh-docs/lists"}