beam/adapters/mod.rs
1//! Storage and network adapters for BEAM.
2//!
3//! This module contains all adapter implementations that connect the
4//! [`crate::Node`] graph engine to external systems:
5//!
6//! # Storage Adapters
7//!
8//! - [`MemoryStorage`] — in-memory `HashMap`-backed storage (default)
9//! - [`RedbStorage`] — persistent embedded storage via [`redb`]
10//!
11//! # Storage Read/Write Split
12//!
13//! Storage adapters that implement [`Actor::try_clone_storage`] are started
14//! as two actors by the Router: a read actor (receives `Get`) and a write
15//! actor (receives `Put`, `BatchPut`, `Flush`). Both share the same
16//! underlying store via `Arc`, so reads see committed writes immediately.
17//!
18//! - [`RedbStorage`] splits — the write actor's `spawn_blocking` fsync no
19//! longer blocks the read actor's concurrent `Get` queries.
20//! - [`MemoryStorage`] does not split — in-memory writes are synchronous
21//! (no fsync), so splitting provides no benefit and would break
22//! read-after-write ordering.
23//!
24//! # Network Adapters
25//!
26//! - [`OutgoingWebsocketManager`] — outgoing WebSocket client manager
27//! - [`WsServer`] — incoming WebSocket server with optional TLS
28//! - [`WsConn`] — per-connection WebSocket actor (used by both client and server)
29//! - [`Multicast`] — UDP multicast LAN discovery
30//! - [`WebRtcPeer`] — WebRTC data channel P2P connection (feature-gated)
31//!
32//! # Adapter Protocol
33//!
34//! All adapters implement the [`crate::actor::Actor`] trait and receive
35//! [`crate::message::Message`] via the actor system. Storage adapters
36//! handle `Get`, `Put`, `BatchPut`, and `Flush`. Network adapters
37//! handle `Put` and `Get` by serializing to the wire format and
38//! forwarding to remote peers.
39
40mod memory_storage;
41mod multicast;
42#[cfg(feature = "persy")]
43pub mod persy_storage;
44mod redb_storage;
45#[cfg(feature = "webrtc")]
46mod webrtc;
47mod ws_client;
48mod ws_conn;
49mod ws_server;
50
51pub use memory_storage::MemoryStorage;
52pub use multicast::Multicast;
53#[cfg(feature = "persy")]
54pub use persy_storage::PersyStorage;
55pub use redb_storage::RedbStorage;
56pub use ws_client::OutgoingWebsocketManager;
57pub use ws_conn::WsConn;
58pub use ws_server::{WsServer, WsServerConfig};
59
60#[cfg(feature = "webrtc")]
61pub use webrtc::{WebRtcPeer, WebRtcRole};