iroh_blobs/lib.rs
1#![doc = include_str!("../README.md")]
2//! Blobs layer for iroh.
3//!
4//! The crate is designed to be used from the [iroh] crate, which provides a
5//! [high level interface](https://docs.rs/iroh/latest/iroh/client/blobs/index.html),
6//! but can also be used standalone.
7//!
8//! It implements a [protocol] for streaming content-addressed data transfer using
9//! [BLAKE3] verified streaming.
10//!
11//! It also provides a [store] interface for storage of blobs and outboards,
12//! as well as a [persistent](crate::store::fs) and a [memory](crate::store::mem)
13//! store implementation.
14//!
15//! To implement a server, the [provider] module provides helpers for handling
16//! connections and individual requests given a store.
17//!
18//! To perform get requests, the [get] module provides utilities to perform
19//! requests and store the result in a store, as well as a low level state
20//! machine for executing requests.
21//!
22//! The [downloader] module provides a component to download blobs from
23//! multiple sources and store them in a store.
24//!
25//! [BLAKE3]: https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf
26//! [iroh]: https://docs.rs/iroh
27#![deny(missing_docs, rustdoc::broken_intra_doc_links)]
28#![recursion_limit = "256"]
29#![cfg_attr(iroh_docsrs, feature(doc_auto_cfg))]
30
31#[cfg(feature = "cli")]
32pub mod cli;
33#[cfg(feature = "downloader")]
34pub mod downloader;
35pub mod export;
36pub mod format;
37pub mod get;
38pub mod hashseq;
39pub mod metrics;
40#[cfg(feature = "net_protocol")]
41pub mod net_protocol;
42pub mod protocol;
43pub mod provider;
44#[cfg(feature = "rpc")]
45pub mod rpc;
46pub mod store;
47pub mod ticket;
48pub mod util;
49
50mod hash;
51
52use bao_tree::BlockSize;
53
54#[doc(inline)]
55pub use crate::protocol::ALPN;
56pub use crate::{
57 hash::{BlobFormat, Hash, HashAndFormat},
58 util::{Tag, TempTag},
59};
60
61/// Block size used by iroh, 2^4*1024 = 16KiB
62pub const IROH_BLOCK_SIZE: BlockSize = BlockSize::from_chunk_log(4);