aura_store/lib.rs
1//! # Aura Store - Layer 2: Specification (Domain Crate)
2//!
3//! **Purpose**: Define storage domain types, semantics, and fact-based state management.
4//!
5//! This crate provides storage domain types, semantics, and pure logic for the Aura platform.
6//! Storage operations are recorded as immutable facts for journal integration.
7//!
8//! # Architecture Constraints
9//!
10//! **Layer 2 depends only on aura-core** (foundation).
11//! - ✓ Storage domain types and semantics
12//! - ✓ Fact types for journal integration (`StorageFact`)
13//! - ✓ Content-addressed storage abstraction
14//! - ✓ CRDT types for distributed storage state
15//! - ✓ Capability metadata types (not authorization logic)
16//! - ✗ NO effect handler implementations (use StorageEffects from aura-effects)
17//! - ✗ NO handler composition (that's aura-composition)
18//! - ✗ NO multi-party protocol logic (that's aura-protocol)
19//!
20//! ## Core Concepts
21//!
22//! - **Content Addressing**: Content-addressed storage with cryptographic chunk IDs
23//! - **Fact-Based State**: Storage changes recorded as `StorageFact` for journals
24//! - **CRDT Storage State**: Distributed storage state with join-semilattice merge
25//! - **Authority Model**: Operations attributed to `AuthorityId`, not devices
26//! - **Search Domain Types**: Query types and result filtering logic
27//!
28//! ## Authorization
29//!
30//! Storage capability types (`StorageCapability`, `StorageResource`) are **metadata**
31//! describing required access levels. Actual authorization is performed via Biscuit
32//! tokens - see `aura-authorization` for the authorization implementation.
33//!
34//! ## What's NOT in this crate
35//!
36//! - Effect handlers (belong in `aura-effects`)
37//! - Coordination logic (belongs in `aura-protocol`)
38//! - Choreographic protocols (belong in feature crates)
39//! - Async execution (pure synchronous domain logic)
40
41#![forbid(unsafe_code)]
42#![warn(missing_docs)]
43
44/// Content addressing and chunk management types
45pub mod chunk;
46
47/// Storage capability metadata types
48pub mod capabilities;
49
50/// Storage domain facts for journal integration
51pub mod facts;
52
53/// Strongly typed identifiers and size wrappers
54pub mod types;
55
56/// Search query types and result filtering logic
57pub mod search;
58
59/// Storage-specific CRDT types and operations
60pub mod crdt;
61
62/// Unified storage error types
63pub mod errors;
64
65// Re-export core types from aura-core
66pub use aura_core::{ChunkId, ContentId, ContentSize};
67
68// Re-export main APIs
69pub use capabilities::{AccessDecision, StorageCapability, StoragePermission, StorageResource};
70pub use chunk::{
71 compute_chunk_layout, plan_chunk_layout_from_size, ChunkLayout, ChunkManifest, ContentManifest,
72 ErasureConfig,
73};
74pub use crdt::{StorageIndex, StorageOpLog, StorageOpType, StorageOperation, StorageState};
75pub use errors::StorageError;
76pub use facts::{StorageFact, StorageFactDelta, StorageFactReducer, STORAGE_FACT_TYPE_ID};
77pub use search::{SearchIndexEntry, SearchQuery, SearchResults, SearchScope};
78pub use types::{ByteSize, ChunkCount, ChunkIndex, NodeId};