nectar_primitives/chunk/mod.rs
1//! Chunk types and operations
2//!
3//! This module provides implementations of various chunk types used in the storage system,
4//! along with functionality for creating, parsing, and verifying chunks.
5//!
6//! # Chunk Type System
7//!
8//! The chunk system is built around a hierarchy of traits:
9//!
10//! - [`Chunk`] - Core trait for all chunk types
11//! - [`ChunkType`] - Adds compile-time type identification
12//! - [`ChunkTypeSet`] - Defines which chunk types a system supports
13//!
14//! # Type-Erased Chunks
15//!
16//! The [`AnyChunk`] enum provides runtime polymorphism for chunks without
17//! requiring object-safe traits.
18
19mod any_chunk;
20mod bmt_body;
21mod chunk_type;
22mod chunk_type_set;
23mod content;
24pub mod encryption;
25pub(crate) mod error;
26mod single_owner;
27mod traits;
28mod type_id;
29
30#[cfg(target_arch = "wasm32")]
31pub mod wasm;
32
33// Re-export the core traits
34pub use traits::{BmtChunk, Chunk, ChunkAddress, ChunkHeader, ChunkMetadata, ChunkSerialization};
35
36// Re-export the type system
37pub use any_chunk::AnyChunk;
38pub use chunk_type::ChunkType;
39pub use chunk_type_set::{ChunkTypeSet, ContentOnlyChunkSet, StandardChunkSet};
40pub use type_id::ChunkTypeId;
41
42// Re-export the concrete chunk types
43pub use content::ContentChunk;
44#[cfg(feature = "encryption")]
45pub use content::EncryptedContentChunk;
46#[cfg(feature = "encryption")]
47pub use encryption::ChunkEncrypt;
48pub use single_owner::SingleOwnerChunk;