hyperlane_plugin_sse/enum.rs
1use super::*;
2
3/// Errors returned by [`crate::SseHub`], [`crate::SseSubscription`], and [`crate::SseStream`] operations.
4#[derive(Clone, Debug, Eq, PartialEq)]
5pub enum SseError {
6 /// Creating a new topic would exceed `SseConfig::max_topics`.
7 TopicLimitReached,
8 /// The underlying topic broadcast channel has closed.
9 ChannelClosed,
10 /// The subscriber lagged behind the broadcast ring by `u64` messages.
11 Lagged(u64),
12 /// Writing an SSE frame to the HTTP response stream failed.
13 Transport(String),
14}
15
16/// Next streaming action yielded to [`SseStream::serve_subscription`].
17pub(crate) enum SseLoopAction {
18 /// One shared SSE event ready to write and optionally coalesce with queued events.
19 Event(Arc<SharedSseEvent>),
20 /// Shared heartbeat bucket ticked and a keep-alive comment should be flushed.
21 Heartbeat,
22 /// The topic closed cleanly and the stream should finish.
23 Closed,
24}