[][src]Trait meio::prelude::LiteTask

pub trait LiteTask: Sized + Send + 'static {
    type Output: Send;
    pub fn name(&self) -> String { ... }
#[must_use] pub fn routine<'async_trait>(
        self,
        stop: StopReceiver
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
    where
        Self: 'async_trait
, { ... }
#[must_use] pub fn interruptable_routine<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
    where
        Self: 'async_trait
, { ... }
#[must_use] pub fn 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
, { ... }
pub fn retry_at(&self, _last_attempt: Instant) -> Instant { ... }
pub fn retry_delay(&self, _last_attempt: Instant) -> Duration { ... } }

Minimalistic actor that hasn't Address.

Recommended to implement sequences or intensive loops (routines).

Associated Types

type Output: Send[src]

The result of a finished task.

Loading content...

Provided methods

pub fn name(&self) -> String[src]

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

#[must_use]pub fn routine<'async_trait>(
    self,
    stop: StopReceiver
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>> where
    Self: 'async_trait, 
[src]

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

#[must_use]pub fn interruptable_routine<'async_trait>(
    self
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>> where
    Self: 'async_trait, 
[src]

Routine that can be unconditionally interrupted.

#[must_use]pub fn 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, 
[src]

Routine that can be retried in case of fail.

pub fn retry_at(&self, _last_attempt: Instant) -> Instant[src]

When to do the next attempt for repeatable_routine.

pub fn retry_delay(&self, _last_attempt: Instant) -> Duration[src]

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

Loading content...

Implementors

impl LiteTask for HeartBeat[src]

type Output = ()

Loading content...