Skip to main content

digdigdig3_station/storage/
mod.rs

1//! Storage subsystem — Phase μ.
2//!
3//! ## Modules
4//!
5//! - `event_log` — legacy append-only flat-file log (κ.2 compat)
6//! - `rotation` — daily rotating writer + raw file reader
7//! - `index` — time-range index sidecar (stub)
8//! - `snapshot` — periodic snapshot writer/reader for stateful streams
9//! - `retention` — auto-delete files older than N days
10//! - `manager` — `StorageManager` owning multiple rotating streams
11//!
12//! On wasm32 only `manager` is available (OPFS-backed). The rest of the
13//! sub-modules (`event_log`, `rotation`, `retention`, `snapshot`, `index`)
14//! use `std::fs` and remain native-only.
15
16// ── Native-only sub-modules ────────────────────────────────────────────────────
17
18#[cfg(not(target_arch = "wasm32"))]
19pub mod event_log;
20#[cfg(not(target_arch = "wasm32"))]
21pub mod index;
22#[cfg(not(target_arch = "wasm32"))]
23pub mod retention;
24#[cfg(not(target_arch = "wasm32"))]
25pub mod rotation;
26#[cfg(not(target_arch = "wasm32"))]
27pub mod snapshot;
28
29// ── StorageManager — cfg-split between native and wasm32 ──────────────────────
30
31#[cfg(not(target_arch = "wasm32"))]
32pub mod manager;
33
34#[cfg(target_arch = "wasm32")]
35#[path = "manager_wasm.rs"]
36pub mod manager;
37
38// ── Re-exports ─────────────────────────────────────────────────────────────────
39
40// StorageManager + config are available on both targets.
41pub use manager::{StorageConfig, StorageManager, StreamKey};
42
43// Native-only types that don't exist on wasm32.
44#[cfg(not(target_arch = "wasm32"))]
45pub use event_log::{EventLog, EventLogIter, EventRecord};