Trait meio::LiteTask[][src]

pub trait LiteTask: Sized + Send + 'static {
    type Output: Send;
    fn name(&self) -> String { ... }
fn routine<'async_trait>(
        self,
        stop: StopReceiver
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
    where
        Self: 'async_trait
, { ... }
fn interruptable_routine<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
    where
        Self: 'async_trait
, { ... }
fn pre_repeatable_routine<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
fn repeatable_routine<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Output>, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
fn retry_at(&mut self, _last_attempt: Instant, succeed: bool) -> Instant { ... }
fn retry_delay(
        &mut self,
        _last_attempt: Instant,
        _succeed: bool
    ) -> Duration { ... } }
Expand description

Minimalistic actor that hasn’t Address.

Recommended to implement sequences or intensive loops (routines).

Associated Types

The result of a finished task.

Provided methods

Returns unique name of the LiteTask. Uses Uuid by default.

Routine of the task that can contain loops. It can taks into accout provided receiver to implement graceful interruption.

By default uses the following calling chain that you can override at any step: routine -> interruptable_routine -> repeatable_routine -> retry_at -> retry_delay

Routine that can be unconditionally interrupted.

Called before repeatable_routine for initialization. The routine will be interrupted if this method failed.

Routine that will be repeated till fail or success.

To stop it you should return Some(value).

When to do the next attempt for repeatable_routine.

succeed means the last attempt was successful.

How long to wait to retry. Called by retry_at method.

succeed means the last attempt was successful.

Implementors