Skip to main content

RequestDecoder

Trait RequestDecoder 

Source
pub trait RequestDecoder: Send + Sync {
    type Event: AppEvent;
    type Role: Role;

    // Required method
    fn decode(
        &self,
        body: &[u8],
        role: ClientRole<Self::Role>,
    ) -> Decoded<Self::Event>;
}
Expand description

Decode an authenticated client request into an application event the runtime can publish to the pipeline.

Stateless on the connection (the runtime carries connection-level state — the client’s role, key_hash — and feeds the relevant piece in per call). Implementors are typically zero-sized types.

Required Associated Types§

Source

type Event: AppEvent

Application event type produced on a successful decode. The runtime wraps this in a transport-level envelope (e.g. JournalEvent::App) before publishing.

Source

type Role: Role

The application’s client roles, named by tokens in the authorized_keys file. NoRoles for an application that admits operator keys only.

Required Methods§

Source

fn decode( &self, body: &[u8], role: ClientRole<Self::Role>, ) -> Decoded<Self::Event>

Decode one request. body is the application frame’s body, up to the end of the frame, and may be empty. role is the role of the key the connection authenticated with: the runtime’s operator, or one of the application’s own.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§