Trait toku_connection::handler::Handler[][src]

pub trait Handler: Send + Sync + 'static {
    type InternalEvent: Send;

    const SEND_GO_AWAY: bool;

    fn max_payload_size(&self) -> ByteSize;
fn upgrade(
        &self,
        tcp_stream: TcpStream
    ) -> Pin<Box<dyn Future<Output = Result<TcpStream, Error>> + Send>>;
fn handshake(
        &mut self,
        reader_writer: ReaderWriter
    ) -> Pin<Box<dyn Future<Output = Result<(Ready, ReaderWriter), (Error, Option<ReaderWriter>)>> + Send>>;
fn handle_frame(
        &mut self,
        frame: DelegatedFrame,
        encoding: &'static str
    ) -> Option<Pin<Box<dyn Future<Output = Result<Response, (Error, u32)>> + Send>>>;
fn handle_internal_event(
        &mut self,
        event: Self::InternalEvent,
        id_sequence: &mut IdSequence
    ) -> Option<TokuFrame>;
fn on_ping_received(&mut self); }
Expand description

A trait that handles the specific functionality of a connection. The client and server each implement this.

Associated Types

Events specific to the implementing connection handler. They will be passed through to the handle_internal_event callback.

Associated Constants

Required methods

The maximum payload size this connection can handle.

Takes a tcp stream and completes an HTTP upgrade.

Hello/HelloAck handshake.

Handle a single delegated frame. Optionally returns a future that resolves to a Response. The Response will be sent back through the socket to the other side.

Handle internal events for this connection. Completely opaque to the connection. Optionally return a TokuFrame that will be sent back through the socket to the other side.

Periodic callback that fires whenever a ping fires.

Implementors