Expand description
Multi-dimensional key-value documents with an efficient synchronization protocol
The crate operates on Replicas. A replica contains an unlimited number of Entries. Each entry is identified by a key, its author, and the replica’s namespace. Its value is the 32-byte BLAKE3 hash 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.
All entries in a replica are signed with two keypairs:
- The
NamespaceSecret
key, as a token of write capability. The public key is theNamespaceId
, which also serves as the unique identifier for a replica. - The Author 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 AuthorId.
Replicas can be synchronized between peers by exchanging messages. The synchronization algorithm is based on a technique called range-based set reconciliation, based on this paper by Aljoscha Meyer:
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.
The crate exposes a generic storage interface. There is an implementation of this interface, store::fs::Store, that can be used either in-memory or in persistent, file-based mode.
Both modes make use of [redb
], an embedded key-value store. When used
in-memory, the store is backed by a Vec<u8>
. When used in persistent mode,
the store is backed by a single file on disk.
Re-exports§
pub use self::sync::*;
Modules§
- This contains an actor spawned on a separate thread to process replica and store operations.
- engine
engine
Handlers and actors to for live syncing replicas. - Metrics for iroh-docs
- net
net
Network implementation of the iroh-docs protocol - protocol
engine
[ProtocolHandler
] implementation for the docsEngine
. - rpc
rpc
Quic RPC implementation for docs. - Storage trait and implementation for iroh-docs documents
- API for iroh-docs replicas
Structs§
- Author key to insert entries in a
crate::Replica
- Timestamps of the latest entry for each author.
AuthorPublicKey
in bytes- Identifier for an
Author
- DocTicket
net
Contains both a key (either secret or public) to a document, and a list of peers to join. NamespacePublicKey
in bytes- The corresponding [
VerifyingKey
] for aNamespaceSecret
. It is used as an identifier, and can be used to verify [Signature
]s. - Namespace key of a
crate::Replica
.