Skip to main content

laminar_core/subscription/
mod.rs

1//! # Reactive Subscription System
2//!
3//! Foundation types for the push-based subscription system that delivers
4//! change events from materialized views and streaming queries to consumers.
5//!
6//! ## Architecture
7//!
8//! The subscription system spans all three rings:
9//!
10//! - **Ring 0**: `NotificationRef` — zero-allocation, cache-line-aligned notification
11//! - **Ring 1**: `ChangeEvent` — data delivery with `Arc<RecordBatch>` payloads
12//! - **Ring 2**: Subscription lifecycle management
13//!
14//! ## Types
15//!
16//! - [`EventType`] — Discriminant for change event kinds (Insert/Delete/Update/Watermark/Snapshot)
17//! - [`NotificationRef`] — 64-byte cache-aligned Ring 0 notification slot
18//! - [`ChangeEvent`] — Rich change event with Arrow data for Ring 1 delivery
19//! - [`ChangeEventBatch`] — Coalesced batch of change events
20
21mod backpressure;
22mod batcher;
23mod callback;
24mod dispatcher;
25mod event;
26mod filter;
27mod handle;
28mod notification;
29mod registry;
30mod stream;
31
32pub use backpressure::{BackpressureController, DemandBackpressure, DemandHandle};
33pub use batcher::{BatchConfig, NotificationBatcher};
34pub use callback::{
35    subscribe_callback, subscribe_fn, CallbackSubscriptionHandle, SubscriptionCallback,
36};
37pub use dispatcher::{
38    DispatcherConfig, DispatcherMetrics, NotificationDataSource, SubscriptionDispatcher,
39};
40pub use event::{ChangeEvent, ChangeEventBatch, EventType, NotificationRef};
41pub use filter::{
42    compile_filter, FilterCompileError, Ring0Predicate, Ring1Predicate, ScalarValue,
43    StringInternTable, SubscriptionFilter,
44};
45pub use handle::{PushSubscription, PushSubscriptionError};
46pub use notification::{NotificationHub, NotificationRing, NotificationSlot};
47pub use registry::{
48    BackpressureStrategy, SubscriptionConfig, SubscriptionEntry, SubscriptionId,
49    SubscriptionMetrics, SubscriptionRegistry, SubscriptionState,
50};
51pub use stream::{
52    subscribe_stream, subscribe_stream_with_errors, ChangeEventResultStream, ChangeEventStream,
53};