Skip to main content

Module backplane

Module backplane 

Expand description

The subscription backplane (docs/design/subscriptions-websocket.md §4): how a published message reaches every replica, so a subscriber connected to one replica sees a write committed on another.

This module holds the contract, the one-replica InProcessBackplane (and the [LocalHub] fan-out it shares with Postgres’ PgNotifyBackplane, in cratestack-sqlx), and the TopicHandle a schema topic is read and written through. None of it touches a database, so a db = None schema’s topics ride on it too.

Delivery is at-most-once (§2.1). A backplane that may have lost messages says so with BackplaneMessage::Resync, and every subscription on that channel ends with unavailable, so the client knows to refetch rather than trust a stream with a silent gap.

Structs§

InProcessBackplane
TopicHandle
One topic under one key. Cheap to build; hold none.

Enums§

BackplaneMessage
One delivery on a backplane channel.

Traits§

SubscriptionBackplane
Fans a published message out to every replica, this one included.

Functions§

model_event_channel
The backplane channel model events of model are published on.
topic_channel
The backplane channel of topic’s messages under key (topic RoomMessage(roomId: String): ChatMessage, slice S4): cratestack.topic.RoomMessage.<key>.

Type Aliases§

BackplaneFuture
A boxed future, so the trait stays object-safe (Arc<dyn SubscriptionBackplane>).
BackplaneReceiver
What SubscriptionBackplane::subscribe returns: everything published on the channel from the moment the subscription is established.