mirror of
https://github.com/n0-computer/iroh.git
synced 2026-11-30 16:03:05 +00:00
30 lines
11 KiB
HTML
30 lines
11 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Multi-dimensional key-value documents with an efficient synchronization protocol"><title>iroh_docs - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b21aa549bf6d91ff.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="iroh_docs" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-e32f0c247825364d.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../iroh_docs/index.html">iroh_docs</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li></ul></section></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../iroh_docs/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Crate <a class="mod" href="#">iroh_docs</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/iroh_docs/lib.rs.html#1-62">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Multi-dimensional key-value documents with an efficient synchronization protocol</p>
|
||
<p>The crate operates on <a href="sync/struct.Replica.html" title="struct iroh_docs::sync::Replica">Replicas</a>. A replica contains an unlimited number of
|
||
<a href="sync/struct.Entry.html" title="struct iroh_docs::sync::Entry">Entries</a>. Each entry is identified by a key, its author, and the replica’s
|
||
namespace. Its value is the <a href="../iroh_base/hash/struct.Hash.html" title="struct iroh_base::hash::Hash">32-byte BLAKE3 hash</a>
|
||
of the entry’s content data, the size of this content data, and a timestamp.
|
||
The content data itself is not stored or transferred through a replica.</p>
|
||
<p>All entries in a replica are signed with two keypairs:</p>
|
||
<ul>
|
||
<li>The <a href="struct.NamespaceSecret.html" title="struct iroh_docs::NamespaceSecret"><code>NamespaceSecret</code></a> key, as a token of write capability. The public key is the
|
||
<a href="struct.NamespaceId.html" title="struct iroh_docs::NamespaceId"><code>NamespaceId</code></a>, which also serves as the unique identifier for a replica.</li>
|
||
<li>The <a href="struct.Author.html" title="struct iroh_docs::Author">Author</a> key, as a proof of authorship. Any number of authors may be created, and
|
||
their semantic meaning is application-specific. The public key of an author is the <a href="struct.AuthorId.html" title="struct iroh_docs::AuthorId">AuthorId</a>.</li>
|
||
</ul>
|
||
<p>Replicas can be synchronized between peers by exchanging messages. The synchronization algorithm
|
||
is based on a technique called <em>range-based set reconciliation</em>, based on <a href="https://arxiv.org/abs/2212.13567">this paper</a> by
|
||
Aljoscha Meyer:</p>
|
||
<blockquote>
|
||
<p>Range-based set reconciliation is a simple approach to efficiently compute the union of two
|
||
sets over a network, based on recursively partitioning the sets and comparing fingerprints of
|
||
the partitions to probabilistically detect whether a partition requires further work.</p>
|
||
</blockquote>
|
||
<p>The crate exposes a <a href="store/fs/struct.Store.html" title="struct iroh_docs::store::fs::Store">generic storage interface</a>. There is an implementation
|
||
of this interface, <a href="store/fs/struct.Store.html" title="struct iroh_docs::store::fs::Store">store::fs::Store</a>, that can be used either
|
||
<a href="store/fs/struct.Store.html#method.memory" title="associated function iroh_docs::store::fs::Store::memory">in-memory</a> or in
|
||
<a href="store/fs/struct.Store.html#method.persistent" title="associated function iroh_docs::store::fs::Store::persistent">persistent, file-based</a> mode.</p>
|
||
<p>Both modes make use of [<code>redb</code>], an embedded key-value store. When used
|
||
in-memory, the store is backed by a <code>Vec<u8></code>. When used in persistent mode,
|
||
the store is backed by a single file on disk.</p>
|
||
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><code>pub use self::<a class="mod" href="sync/index.html" title="mod iroh_docs::sync">sync</a>::*;</code></div></li></ul><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="actor/index.html" title="mod iroh_docs::actor">actor</a></div><div class="desc docblock-short">This contains an actor spawned on a separate thread to process replica and store operations.</div></li><li><div class="item-name"><a class="mod" href="engine/index.html" title="mod iroh_docs::engine">engine</a><span class="stab portability" title="Available on crate feature `engine` only"><code>engine</code></span></div><div class="desc docblock-short">Handlers and actors to for live syncing replicas.</div></li><li><div class="item-name"><a class="mod" href="metrics/index.html" title="mod iroh_docs::metrics">metrics</a></div><div class="desc docblock-short">Metrics for iroh-docs</div></li><li><div class="item-name"><a class="mod" href="net/index.html" title="mod iroh_docs::net">net</a><span class="stab portability" title="Available on crate feature `net` only"><code>net</code></span></div><div class="desc docblock-short">Network implementation of the iroh-docs protocol</div></li><li><div class="item-name"><a class="mod" href="store/index.html" title="mod iroh_docs::store">store</a></div><div class="desc docblock-short">Storage trait and implementation for iroh-docs documents</div></li><li><div class="item-name"><a class="mod" href="sync/index.html" title="mod iroh_docs::sync">sync</a></div><div class="desc docblock-short">API for iroh-docs replicas</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Author.html" title="struct iroh_docs::Author">Author</a></div><div class="desc docblock-short">Author key to insert entries in a <a href="sync/struct.Replica.html" title="struct iroh_docs::sync::Replica"><code>crate::Replica</code></a></div></li><li><div class="item-name"><a class="struct" href="struct.AuthorHeads.html" title="struct iroh_docs::AuthorHeads">AuthorHeads</a></div><div class="desc docblock-short">Timestamps of the latest entry for each author.</div></li><li><div class="item-name"><a class="struct" href="struct.AuthorId.html" title="struct iroh_docs::AuthorId">AuthorId</a></div><div class="desc docblock-short"><a href="struct.AuthorPublicKey.html" title="struct iroh_docs::AuthorPublicKey"><code>AuthorPublicKey</code></a> in bytes</div></li><li><div class="item-name"><a class="struct" href="struct.AuthorPublicKey.html" title="struct iroh_docs::AuthorPublicKey">AuthorPublicKey</a></div><div class="desc docblock-short">Identifier for an <a href="struct.Author.html" title="struct iroh_docs::Author"><code>Author</code></a></div></li><li><div class="item-name"><a class="struct" href="struct.DocTicket.html" title="struct iroh_docs::DocTicket">DocTicket</a><span class="stab portability" title="Available on crate feature `net` only"><code>net</code></span></div><div class="desc docblock-short">Contains both a key (either secret or public) to a document, and a list of peers to join.</div></li><li><div class="item-name"><a class="struct" href="struct.NamespaceId.html" title="struct iroh_docs::NamespaceId">NamespaceId</a></div><div class="desc docblock-short"><a href="struct.NamespacePublicKey.html" title="struct iroh_docs::NamespacePublicKey"><code>NamespacePublicKey</code></a> in bytes</div></li><li><div class="item-name"><a class="struct" href="struct.NamespacePublicKey.html" title="struct iroh_docs::NamespacePublicKey">NamespacePublicKey</a></div><div class="desc docblock-short">The corresponding [<code>VerifyingKey</code>] for a <a href="struct.NamespaceSecret.html" title="struct iroh_docs::NamespaceSecret"><code>NamespaceSecret</code></a>.
|
||
It is used as an identifier, and can be used to verify [<code>Signature</code>]s.</div></li><li><div class="item-name"><a class="struct" href="struct.NamespaceSecret.html" title="struct iroh_docs::NamespaceSecret">NamespaceSecret</a></div><div class="desc docblock-short">Namespace key of a <a href="sync/struct.Replica.html" title="struct iroh_docs::sync::Replica"><code>crate::Replica</code></a>.</div></li></ul></section></div></main></body></html> |