Expand description
§Reactive Subscription System
Foundation types for the push-based subscription system that delivers change events from materialized views and streaming queries to consumers.
§Architecture
The subscription system spans all three rings:
- Ring 0:
NotificationRef— zero-allocation, cache-line-aligned notification - Ring 1:
ChangeEvent— data delivery withArc<RecordBatch>payloads - Ring 2: Subscription lifecycle management
§Types
EventType— Discriminant for change event kinds (Insert/Delete/Update/Watermark/Snapshot)NotificationRef— 64-byte cache-aligned Ring 0 notification slotChangeEvent— Rich change event with Arrow data for Ring 1 deliveryChangeEventBatch— Coalesced batch of change events
Structs§
- Backpressure
Controller - Per-subscription backpressure controller.
- Batch
Config - Configuration for notification batching.
- Callback
Subscription Handle - Handle for a callback-based subscription.
- Change
Event Batch - A batch of change events for coalesced delivery to subscribers.
- Change
Event Result Stream - Async stream that also yields lag errors.
- Change
Event Stream - Async stream wrapper for push subscriptions.
- Demand
Backpressure - Demand-based backpressure (Reactive Streams
request(n)model). - Demand
Handle - Handle given to the subscriber to request more events.
- Dispatcher
Config - Configuration for the
SubscriptionDispatcher. - Dispatcher
Metrics - Atomic counters for monitoring the dispatcher.
- Notification
Batcher - Accumulates events per source and flushes as batches.
- Notification
Hub - Manages notification slots and the SPSC ring for a single reactor core.
- Notification
Ref - Zero-allocation notification reference for Ring 0.
- Notification
Ring - Lock-free SPSC ring buffer carrying
NotificationReffrom Ring 0 to Ring 1. - Notification
Slot - Per-source notification slot with atomic sequence counter.
- Push
Subscription - A push-based subscription handle.
- String
Intern Table - Intern table for string values used in Ring 0 predicates.
- Subscription
Config - Configuration for a subscription.
- Subscription
Dispatcher - Ring 1 dispatcher that routes notifications to subscriber channels.
- Subscription
Entry - A registered subscription entry with state, config, channel, and metrics.
- Subscription
Filter - Compiled subscription filter.
- Subscription
Id - Unique subscription identifier.
- Subscription
Metrics - Point-in-time metrics snapshot for a subscription.
- Subscription
Registry - Registry managing all active subscriptions.
Enums§
- Backpressure
Strategy - Strategy applied when a subscription’s channel buffer is full.
- Change
Event - A change event carrying Arrow data for subscriber delivery.
- Event
Type - Discriminant for change event kinds.
- Filter
Compile Error - Filter compilation errors.
- Push
Subscription Error - Errors from push subscription operations.
- Ring0
Predicate - Ring 0 predicate (must be zero-allocation, < 50ns).
- Ring1
Predicate - Ring 1 predicate (can allocate, evaluated in Ring 1 dispatcher).
- Scalar
Value - Scalar value for Ring 0 predicate comparison.
- Subscription
State - Lifecycle state of a subscription.
Traits§
- Notification
Data Source - Resolves a
NotificationRefinto a fullChangeEvent. - Subscription
Callback - Callback trait for push-based subscriptions.
Functions§
- compile_
filter - Compiles a filter expression into Ring 0 and Ring 1 predicates.
- subscribe_
callback - Creates a callback-based subscription.
- subscribe_
fn - Creates a closure-based subscription (convenience wrapper).
- subscribe_
stream - Creates an async
Streamsubscription. - subscribe_
stream_ with_ errors - Creates an async
Streamthat also yields errors.