1#![forbid(unsafe_code)]
4
5mod engine;
6mod local;
7mod model;
8mod scheduler;
9mod stream;
10
11pub use engine::{BlobEngine, FetchMetrics, FetchOptions};
12pub use local::{BlobProtocol, IrohBlobStore};
13pub use model::BlobRef;
14pub use scheduler::{BlobPriority, FetchScheduler, ProviderMetrics};
15pub use stream::BlobStream;
16
17#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
19pub enum BlobError {
20 #[error("blob repository failed: {0}")]
22 Store(String),
23 #[error("blob is not available locally: {0}")]
25 MissingBlob(iroh_db_core::BlobHash),
26 #[error("blob content hash mismatch")]
28 HashMismatch,
29 #[error("blob reference belongs to another domain or epoch")]
31 WrongDomainOrEpoch,
32 #[error("blob authentication failed")]
34 AuthenticationFailed,
35 #[error("blob encryption failed")]
37 EncryptionFailed,
38 #[error("blob key derivation failed")]
40 KeyDerivationFailed,
41 #[error("blob manifest is invalid")]
43 InvalidManifest,
44 #[error("blob codec failed: {0}")]
46 Codec(String),
47 #[error("chunk size must be between 64 KiB and 8 MiB, got {0}")]
49 InvalidChunkSize(usize),
50 #[error("blob is too large")]
52 BlobTooLarge,
53 #[error("blob import stream failed: {0}")]
55 Read(String),
56 #[error("cryptographic randomness is unavailable")]
58 RandomnessUnavailable,
59 #[error("no blob providers are available")]
61 NoProviders,
62 #[error("remote blob concurrency must be non-zero, got {0}")]
64 InvalidFetchConcurrency(usize),
65 #[error("remote blob scheduler is unavailable")]
67 SchedulerUnavailable,
68 #[error("remote blob fetch was cancelled")]
70 FetchCancelled,
71}