Skip to main content

StreamOpener

Trait StreamOpener 

pub trait StreamOpener: Send + 'static {
    // Required methods
    fn open_frame<'life0, 'async_trait>(
        &'life0 mut self,
        frame: Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<OpenedFrame, CratestackError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn finish(self: Box<Self>) -> Result<(), CratestackError>;
}
Expand description

Verifies one incoming stream (§6). Framing is not its job. The cbor-seq chunk decoder splits the body into data items and hands each one here. The opener classifies it (item, or Tag(48901) checkpoint) and checks the chain.

Provisional; the shape is finalised in P1 (cratestack#1008, cratestack#1009).

Required Methods§

fn open_frame<'life0, 'async_trait>( &'life0 mut self, frame: Bytes, ) -> Pin<Box<dyn Future<Output = Result<OpenedFrame, CratestackError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Feed one framed data item. An Err is tampering (a reordered, dropped or injected item breaks the hash at the next checkpoint, and a forged checkpoint fails its signature), and the stream must be rejected.

fn finish(self: Box<Self>) -> Result<(), CratestackError>

The body ended. Err unless a terminal checkpoint verified: a stream cut short by a middlebox that closes cleanly is Incomplete, not a short successful stream.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§