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//! # Feature flags
26//!
27//! - rpc: Enable the rpc server and client. Enabled by default.
28//! - net_protocol: Enable the network protocol. Enabled by default.
29//! - downloader: Enable the downloader. Enabled by default.
30//! - fs-store: Enable the filesystem store. Enabled by default.
31//!
32//! - cli: Enable the cli. Disabled by default.
33//! - example-iroh: dependencies for examples in this crate. Disabled by default.
34//! - test: test utilities. Disabled by default.
35//!
36//! [BLAKE3]: https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf
37//! [iroh]: https://docs.rs/iroh
38#![deny(missing_docs, rustdoc::broken_intra_doc_links)]
39#![recursion_limit = "256"]
40#![cfg_attr(iroh_docsrs, feature(doc_auto_cfg))]
41
42#[cfg(feature = "cli")]
43pub mod cli;
44#[cfg(feature = "downloader")]
45pub mod downloader;
46pub mod export;
47pub mod format;
48pub mod get;
49pub mod hashseq;
50pub mod metrics;
51#[cfg(feature = "net_protocol")]
52pub mod net_protocol;
53pub mod protocol;
54pub mod provider;
55#[cfg(feature = "rpc")]
56pub mod rpc;
57pub mod store;
58pub mod ticket;
59pub mod util;
60
61mod hash;
62
63use bao_tree::BlockSize;
64
65#[doc(inline)]
66pub use crate::protocol::ALPN;
67pub use crate::{
68    hash::{BlobFormat, Hash, HashAndFormat},
69    util::{Tag, TempTag},
70};
71
72/// Block size used by iroh, 2^4*1024 = 16KiB
73pub const IROH_BLOCK_SIZE: BlockSize = BlockSize::from_chunk_log(4);