BackendExt

Trait BackendExt 

Source
pub trait BackendExt: Backend {
    type Codec: Codec<Self::Args, Compact = Self::Compact>;
    type Compact;
    type CompactStream: Stream<Item = Result<Option<Task<Self::Compact, Self::Context, Self::IdType>>, Self::Error>>;

    // Required method
    fn poll_compact(self, worker: &WorkerContext) -> Self::CompactStream;
}
Expand description

Defines the encoding/serialization aspects of a backend.

Required Associated Types§

Source

type Codec: Codec<Self::Args, Compact = Self::Compact>

The codec used for serialization/deserialization of tasks.

Source

type Compact

The compact representation of task arguments.

Source

type CompactStream: Stream<Item = Result<Option<Task<Self::Compact, Self::Context, Self::IdType>>, Self::Error>>

A stream of encoded tasks provided by the backend.

Required Methods§

Source

fn poll_compact(self, worker: &WorkerContext) -> Self::CompactStream

Polls the backend for encoded tasks for the given worker.

Implementors§

Source§

impl<Args: 'static + Send + Serialize + DeserializeOwned + Unpin> BackendExt for JsonStorage<Args>

Available on crate feature json only.
Source§

impl<Args: Clone + Send + 'static, Ctx: Default + 'static> BackendExt for MemoryStorage<Args, Ctx>

Source§

type Codec = IdentityCodec

Source§

type Compact = Args

Source§

type CompactStream = Pin<Box<dyn Stream<Item = Result<Option<Task<Args, <MemoryStorage<Args, Ctx> as Backend>::Context>>, <MemoryStorage<Args, Ctx> as Backend>::Error>> + Send>>