Skip to main content

Module events

Module events 

Source
Expand description

Server-wide event stream.

The embedding API exposes a tokio::sync::broadcast of ServerEvent values so consumers can observe peer transitions, gossip rounds, configuration reloads, and other cluster-wide signals. The handle returned by crate::embed::ServerHandle::subscribe_events wraps the broadcast receiver in EventStream for ergonomic polling.

Only the engine publishes to the bus; embedding programs subscribe through EventBus::subscribe and consume via EventStream::recv / EventStream::try_recv.

§Examples

use dynomite::embed::events::{ConnRoleTag, CloseReason, PeerDownReason, EventBus};
let bus = EventBus::new(16);
let _rx = bus.subscribe();
assert_eq!(bus.subscriber_count(), 1);

Structs§

EventBus
Event publisher held by the embed runtime.
EventStream
Pollable async stream of ServerEvents.

Enums§

CloseReason
Reason carried with ServerEvent::ConnectionClosed.
ConnRoleTag
Summary tag for the role of a connection at accept time.
PeerDownReason
Reason carried with ServerEvent::PeerDown.
ServerEvent
Cluster-wide event published on the broadcast channel.

Type Aliases§

ConnId
Identifier handed out for every accepted connection.
PeerId
Identifier of a peer in the cluster pool.