mod decoder;
mod framing;
pub(crate) mod http;
mod json;
mod request;
mod timing;
mod wire;
pub use decoder::{DecodeStep, NotificationDecoder};
pub use http::{
HttpNotificationError, HttpNotificationOptions, HttpNotificationSubscription,
NotificationCancellation, NotificationRetryOptions, NotificationTimeoutStage,
};
pub use request::SubscriptionRequest;
pub use timing::{NotificationTiming, TimerLimits};
pub use wire::{NotificationReady, NotificationWireEvent, ServerFailure};
pub const MAX_NOTIFICATION_WIRE_BYTES: usize = 65_536;
#[derive(Clone, Copy, Debug, PartialEq, Eq, thiserror::Error)]
pub enum ProtocolError {
#[error("notification protocol input exceeds its byte limit")]
ByteLimit,
#[error("notification protocol input is not valid UTF-8")]
InvalidUTF8,
#[error("notification protocol JSON is invalid or exceeds its nesting envelope")]
InvalidJSON,
#[error("notification protocol fields are invalid")]
InvalidFields,
#[error("notification protocol version is unsupported")]
UnsupportedVersion,
#[error("notification channel selection is invalid")]
InvalidChannels,
#[error("notification channel count exceeds its configured limit")]
ChannelLimit,
#[error("notification protocol does not support resumption")]
ResumeUnsupported,
#[error("notification response identity is invalid or changed")]
Identity,
#[error("notification event order is invalid")]
EventOrder,
#[error("notification sequence is invalid")]
Sequence,
#[error("notification payload exceeds its byte limit")]
Payload,
#[error("notification timing relationship is invalid")]
Timing,
#[error("notification timing exceeds the receiving runtime or local deadline")]
TimerRange,
#[error("notification protocol allocation failed")]
Allocation,
#[error("notification stream ended without a complete terminal frame")]
UnexpectedEnd,
}
#[cfg(test)]
mod tests;