Trait Backend

Source
pub trait Backend<Req> {
    type Stream: Stream<Item = Result<Option<Req>, Error>>;
    type Layer;
    type Codec: Codec;

    // Required method
    fn poll(self, worker: &Worker<Context>) -> Poller<Self::Stream, Self::Layer>;
}
Expand description

A backend represents a task source Both Storage and MessageQueue need to implement it for workers to be able to consume tasks

Required Associated Types§

Source

type Stream: Stream<Item = Result<Option<Req>, Error>>

The stream to be produced by the backend

Source

type Layer

Returns the final decoration of layers

Source

type Codec: Codec

Specifies the codec type used by the backend

Required Methods§

Source

fn poll(self, worker: &Worker<Context>) -> Poller<Self::Stream, Self::Layer>

Returns a poller that is ready for streaming

Implementors§

Source§

impl<T, Ctx> Backend<Request<T, Ctx>> for RequestStream<Request<T, Ctx>>

Source§

impl<T: Send + 'static + Sync> Backend<Request<T, ()>> for MemoryStorage<T>