digdigdig3_station/lib.rs
1//! `digdigdig3-station` — Layer 2 of the digdigdig3 workspace.
2//!
3//! High-level consumer-facing builder over [`digdigdig3::connector_manager::ExchangeHub`].
4//! See `docs/plans/station-architecture.md` for design, `docs/plans/station-phase-1-plan.md`
5//! for the phase-by-phase implementation roadmap.
6//!
7//! Phase 1 scope (current): skeleton only. Modules below are stubs.
8
9pub mod backfill;
10pub mod builder;
11pub mod settings;
12pub mod cache;
13pub mod data;
14pub(crate) mod derived;
15pub mod error;
16pub mod persistence;
17pub mod quota;
18pub mod series;
19pub mod station;
20pub mod subscription;
21
22// Modules moved from dig3-core (persistence/cache/cure/OB concerns belong in station)
23pub mod orderbook;
24pub mod rest_cache;
25
26#[cfg(feature = "reconnect")]
27pub mod reconnect;
28
29// OPFS helpers — wasm32 only, shared by store_wasm + manager_wasm.
30#[cfg(target_arch = "wasm32")]
31pub(crate) mod opfs_helpers;
32
33// storage: native uses std::fs; wasm32 uses OPFS-backed manager.
34// On wasm32 only StorageManager / StorageConfig / StreamKey are available;
35// the sub-modules that use std::fs (event_log, rotation, retention, snapshot,
36// index) remain native-only inside storage/mod.rs.
37pub mod storage;
38
39// cure: pure logic over StorageManager — compiles on both targets.
40pub mod cure;
41
42// replay: backed by StorageManager; ws.rs has cfg-split for tokio::spawn /
43// wasm_bindgen_futures::spawn_local and tokio::time::sleep / gloo_timers.
44pub mod replay;
45
46// polling + gap_heal: REST-based; work on wasm via rest_override (Workstream A).
47// spawn_poller uses cfg-split tokio::spawn / wasm_bindgen_futures::spawn_local.
48pub(crate) mod polling;
49
50pub mod gap_heal;
51
52pub use builder::StationBuilder;
53pub use cache::{ticker_cache, CacheConfig, TickerKey};
54pub use error::{Result, StationError};
55pub use persistence::PersistenceConfig;
56pub use series::{DataPoint, Kind, Series, SeriesKey, SharedSeriesMap};
57pub use quota::{ConsumerHandle, ConsumerQuota, ConsumerWhitelist, QuotaError};
58pub use station::Station;
59pub use subscription::{
60 Event, FailedStream, Stream, SubscribeReport, SubscriptionHandle, SubscriptionSet,
61};
62
63// DiskStore is available on both targets (native: std::fs; wasm32: OPFS).
64pub use series::DiskStore;
65
66// PollSpec, PollSource, GapHealConfig: available on both targets.
67// polling is now un-gated; gap_heal is un-gated.
68pub use series::PollSpec;
69pub use polling::PollSource;
70pub use gap_heal::GapHealConfig;
71
72// StorageManager and friends — available on both targets now.
73pub use storage::{StorageConfig, StorageManager, StreamKey};
74
75// EventLog is native-only (std::fs backed).
76#[cfg(not(target_arch = "wasm32"))]
77pub use storage::{EventLog, EventLogIter, EventRecord};
78
79pub use replay::{ReplayHub, ReplayConfig, ReplayRate};
80
81pub use orderbook::{OrderBookTracker, OrderBookError};
82pub use rest_cache::RestCache;
83
84// Settings store — native (file) and wasm32 (OPFS) at API parity.
85pub use settings::{SettingsError, SettingsStore};
86
87pub use cure::{
88 IntegrityChecker, IntegrityReport,
89 Deduper,
90 GapDetector, GapInfo,
91 RepairPipeline, RepairReport,
92};
93
94// Re-export common core types so consumers can build a SubscriptionSet without
95// pulling `digdigdig3` directly.
96pub use digdigdig3::core::types::{AccountType, ExchangeId};