pub enum Frame {
Show 30 variants
Connect {
flags: u8,
min_version: ProtocolVersion,
max_version: ProtocolVersion,
auth_token: Vec<u8>,
},
ConnectAck {
flags: u8,
selected_version: ProtocolVersion,
capabilities: u32,
},
ConnectError {
flags: u8,
reason_code: u16,
message: Option<String>,
},
Disconnect {
flags: u8,
},
DisconnectReason {
flags: u8,
reason: DisconnectReason,
},
Subscribe {
flags: u8,
stream_id: u32,
channel: String,
accepted_schemas: Vec<SchemaId>,
max_in_flight: u32,
},
SubscribeAck {
flags: u8,
stream_id: u32,
subscription_id: u64,
selected_schema: SchemaId,
},
SubscribeError {
flags: u8,
stream_id: u32,
reason_code: u16,
message: Option<String>,
},
Unsubscribe {
flags: u8,
stream_id: u32,
subscription_id: u64,
},
Publish {
flags: u8,
stream_id: u32,
channel: String,
envelope: MessageEnvelope,
idempotency_key: Option<String>,
},
PublishAck {
flags: u8,
stream_id: u32,
message_id: u64,
durable_position: Option<u64>,
},
PublishError {
flags: u8,
stream_id: u32,
reason_code: u16,
message: Option<String>,
},
ConversationOpen {
flags: u8,
stream_id: u32,
conversation_id: u64,
subject: String,
},
ConversationMessage {
flags: u8,
stream_id: u32,
conversation_id: u64,
envelope: MessageEnvelope,
},
ConversationClose {
flags: u8,
stream_id: u32,
conversation_id: u64,
reason_code: Option<u16>,
message: Option<String>,
},
ConversationError {
flags: u8,
stream_id: u32,
conversation_id: u64,
reason_code: u16,
message: Option<String>,
},
Accept {
flags: u8,
stream_id: u32,
referenced_message_id: MessageId,
},
Defer {
flags: u8,
stream_id: u32,
referenced_message_id: MessageId,
reason: Option<String>,
},
Reject {
flags: u8,
stream_id: u32,
referenced_message_id: MessageId,
reason: Option<String>,
},
Ping {
flags: u8,
},
Pong {
flags: u8,
},
Push {
flags: u8,
stream_id: u32,
correlation_id: u64,
payload: Vec<u8>,
},
PushReply {
flags: u8,
stream_id: u32,
correlation_id: u64,
payload: Vec<u8>,
},
WorkerRegister {
flags: u8,
registration: WorkerRegistration,
},
WorkerRegisterAck {
flags: u8,
outcome: WorkerRegisterOutcome,
},
Deliver {
flags: u8,
stream_id: u32,
delivery_seq: u64,
envelope: MessageEnvelope,
message: Option<DeliveredId>,
},
LinkOpen {
flags: u8,
stream_id: u32,
offer: LinkOffer,
},
LinkOpenAck {
flags: u8,
stream_id: u32,
outcome: LinkOpenOutcome,
},
LinkMessage {
flags: u8,
stream_id: u32,
subject: String,
sealed: Vec<u8>,
},
Unknown {
type_id: u8,
flags: u8,
stream_id: u32,
payload: Vec<u8>,
},
}Expand description
A typed protocol frame body plus the header metadata required to encode it.
Variants§
Connect
Connection request carrying a supported version range and opaque auth token.
ConnectAck
Connection success carrying the negotiated protocol version and server capabilities.
ConnectError
Connection failure carrying a numeric reason and optional message.
Disconnect
Connection close notification with no payload.
DisconnectReason
Server close carrying a stable reason (ACCESS-005 R5): the body is a
version byte (DISCONNECT_REASON_BODY_VERSION), the reason’s code
and its name. Written only on a connection at
REVOCATION_CLOSE_VERSION or later; the payload-free
Frame::Disconnect is unchanged.
Subscribe
Channel subscription request carrying a channel and accepted schema hashes.
SubscribeAck
Channel subscription success carrying a subscription id and selected schema.
SubscribeError
Channel subscription failure carrying a numeric reason and optional message.
Unsubscribe
Channel unsubscription request carrying the subscription id.
Publish
Publish request carrying a channel and typed message envelope.
idempotency_key is Some only when the PUBLISH_IDEMPOTENCY_KEY_FLAG
flag bit is set; it is the dedup-on-delivery key the server feeds to its
dedup cache. When None (and the flag clear) the frame is byte-identical
on the wire to a pre-13-L1 publish.
Fields
envelope: MessageEnvelopePublishAck
Publish success carrying the accepted message id.
durable_position is Some only when the ack answers for a stored row
and the connection negotiated PUBLISH_ACK_POSITION_VERSION; the codec
then sets PUBLISH_DURABLE_POSITION_FLAG and writes the position after
message_id. When None the frame is byte-identical to the older ack.
PublishError
Publish failure carrying a numeric reason and optional message.
ConversationOpen
Conversation open carrying a conversation id and subject.
ConversationMessage
Conversation message carrying a conversation id and typed message envelope.
ConversationClose
Conversation close carrying a conversation id and optional reason.
Fields
ConversationError
Conversation failure carrying a conversation id, numeric reason, and optional message.
Accept
Backpressure acceptance for a delivered message.
Defer
Backpressure deferral for a buffered message.
Reject
Backpressure rejection for a shed message.
Ping
Connection keepalive ping.
Pong
Connection keepalive pong.
Push
Server-initiated push carrying a correlation id and an opaque payload.
A server writes this frame to a connected client over the client’s existing
connection (server-to-client, the inverse of every other request frame). The
correlation_id is the key the server uses to match the client’s later
Frame::PushReply back to this push; the payload is opaque application
bytes the server hands the client. This is an application-stream frame, so
stream_id is non-zero like a publish or conversation message.
PushReply
Client-initiated correlated reply to a Frame::Push.
After handling a pushed frame the client writes this back on the same
connection, echoing the push’s correlation_id so the server can match the
reply to the originating push. The payload is the client’s opaque answer.
WorkerRegister
Worker self-registration over an established connection.
A worker sends this control frame (stream 0) after the connection
handshake to announce its identity and routing dimensions. The server
associates the registration with the connection’s process id and surfaces
it to the application via the connection-notifier hook, then answers with a
Frame::WorkerRegisterAck. node is optional locality and is encoded
with a presence byte, never flattened to an empty string.
WorkerRegisterAck
Server acknowledgement of a Frame::WorkerRegister.
Carries the registration outcome: WorkerRegisterOutcome::Accepted when
the server (and any configured notifier) accepted the worker, or
WorkerRegisterOutcome::Rejected carrying a human-readable reason when it
did not. The acknowledgement is synchronous so a worker never believes it is
registered when the application rejected it.
Deliver
Server-to-client delivery of a message on a subscription the client opened.
The server writes this frame on the subscription’s own stream_id (the
non-zero application stream negotiated by the client’s Subscribe). It is
the only server-originated delivery frame, and it is only ever sent on a
subscription the client itself opened, so the forward-compatibility rules
for unknown frames never surprise an old client with one. delivery_seq is
a per-subscription monotonic counter starting at 1 — the anchor the future
ack/resume (A1 v2 credit) protocol builds on. The envelope reuses the same
MessageEnvelope serialization as publish and conversation frames.
message is Some only when the server knows the message’s id and boot
and the connection negotiated DELIVER_MESSAGE_ID_VERSION; the codec
then sets DELIVER_MESSAGE_ID_FLAG and writes the pair after the
envelope. When None the frame is byte-identical to the older Deliver.
LinkOpen
A machine opening one end of a link on this application stream (ACCESS-002 R1). The server decides the open with Lys, live, for the grant the offered end names on the link, proves the offered machine key is the verified holder’s recorded key, and answers the handshake.
LinkOpenAck
The server’s answer to a Frame::LinkOpen on the same stream.
LinkMessage
One message crossing an open link on its stream: the subject it is published on, and the message envelope sealed by the link’s transport. The receiving end decides the crossing from both machines’ passes before any effect.
Unknown
Forward-compatible frame preserved after length-delimited skipping.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn new_ping(stream_id: u32) -> Result<Self, ProtocolError>
pub fn new_ping(stream_id: u32) -> Result<Self, ProtocolError>
Construct a ping frame, enforcing the stream-0 control-frame invariant.
§Errors
Returns ProtocolError::InvalidStream when stream_id is not zero.
Sourcepub fn new_publish(
stream_id: u32,
channel: impl Into<String>,
envelope: MessageEnvelope,
) -> Result<Self, ProtocolError>
pub fn new_publish( stream_id: u32, channel: impl Into<String>, envelope: MessageEnvelope, ) -> Result<Self, ProtocolError>
Construct a publish frame, enforcing the non-zero application-stream invariant.
§Errors
Returns ProtocolError::InvalidStream when stream_id is zero.
Sourcepub fn new_publish_with_idempotency_key(
stream_id: u32,
channel: impl Into<String>,
envelope: MessageEnvelope,
idempotency_key: impl Into<String>,
) -> Result<Self, ProtocolError>
pub fn new_publish_with_idempotency_key( stream_id: u32, channel: impl Into<String>, envelope: MessageEnvelope, idempotency_key: impl Into<String>, ) -> Result<Self, ProtocolError>
Construct a publish frame carrying an idempotency key for dedup-on-delivery.
The returned frame has PUBLISH_IDEMPOTENCY_KEY_FLAG set and serializes
the trailing key field, so the server consults its dedup cache for this key.
§Errors
Returns ProtocolError::InvalidStream when stream_id is zero.
Sourcepub fn new_push(
stream_id: u32,
correlation_id: u64,
payload: Vec<u8>,
) -> Result<Self, ProtocolError>
pub fn new_push( stream_id: u32, correlation_id: u64, payload: Vec<u8>, ) -> Result<Self, ProtocolError>
Construct a server-to-client push frame, enforcing the non-zero application-stream invariant.
§Errors
Returns ProtocolError::InvalidStream when stream_id is zero.
Sourcepub fn new_deliver(
stream_id: u32,
delivery_seq: u64,
envelope: MessageEnvelope,
) -> Result<Self, ProtocolError>
pub fn new_deliver( stream_id: u32, delivery_seq: u64, envelope: MessageEnvelope, ) -> Result<Self, ProtocolError>
Construct a server-to-client delivery frame on a subscription’s stream, enforcing the non-zero application-stream invariant.
§Errors
Returns ProtocolError::InvalidStream when stream_id is zero.
Sourcepub fn new_push_reply(
stream_id: u32,
correlation_id: u64,
payload: Vec<u8>,
) -> Result<Self, ProtocolError>
pub fn new_push_reply( stream_id: u32, correlation_id: u64, payload: Vec<u8>, ) -> Result<Self, ProtocolError>
Construct a client-to-server push reply frame, echoing the correlation id of the originating push, and enforcing the non-zero application-stream invariant.
§Errors
Returns ProtocolError::InvalidStream when stream_id is zero.
Sourcepub const fn frame_type(&self) -> FrameType
pub const fn frame_type(&self) -> FrameType
Return the frame type represented by this frame body.
Sourcepub const fn wire_flags(&self) -> u8
pub const fn wire_flags(&self) -> u8
Return the flags byte the codec writes into the fixed header.
This is Frame::flags except on a Frame::PublishAck, whose
PUBLISH_DURABLE_POSITION_FLAG bit is set exactly when the ack carries
a durable position, and a Frame::Deliver, whose
DELIVER_MESSAGE_ID_FLAG bit is set exactly when it carries a
DeliveredId, so the bit and the trailing field never disagree.
Trait Implementations§
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.