Skip to main content

Module events

Module events 

Source
Expand description

Event capture + REST surface for streaming CPAPI topics.

bezant-server runs an internal bezant::WsClient that subscribes to order, PnL, and (lazily) market-data feeds. Decoded frames go into per-topic ring buffers behind cursor-based REST endpoints (/events/{topic}?since=<cursor>), so polling consumers can read every event the socket has seen since their last visit — no events lost between client polls, no need to keep a long-lived WS open from the consumer side.

See the architecture sketch:

CPGateway WS  ─► bezant_core::WsClient  ─► Connector (tokio task)
                                             │
                                             ▼
                                      per-topic TopicRing
                                             │
                                             ▼
                                 GET /events/{topic}?since=<cursor>

Re-exports§

pub use connector::spawn_connector;
pub use connector::ConnectorCfg;
pub use connector::EventsHandle;
pub use persistence::EventLog;
pub use persistence::RetentionPolicy;
pub use ring::ReadResult;
pub use ring::TopicRing;

Modules§

connector
Long-lived WebSocket connector + REST-side handle.
persistence
Optional sqlite persistence for captured events.
ring
Per-topic ring buffer for captured events.

Structs§

EventsStatus
Snapshot of the connector’s state, returned by GET /events/_status.
ObservedEvent
One captured event. Wire-shape returned by /events/{topic} endpoints.

Enums§

GapReason
Reason a synthetic ObservedEvent of topic "gap" was injected. Surfaced to the client so they know they missed something.