Skip to main content

WorkHooks

Trait WorkHooks 

Source
pub trait WorkHooks:
    Send
    + Sync
    + 'static {
    // Provided methods
    fn may_reserve(&self) -> bool { ... }
    fn attempted(&self, attempt: &Attempt) { ... }
}
Expand description

What a supervisor (navree-fleet’s workers) puts around a worker: asked before every reservation, told after every attempt. Both run on the worker’s task, so keep them quick.

Provided Methods§

Source

fn may_reserve(&self) -> bool

Whether the worker may take a job now. false holds it (a paused supervisor): it takes nothing and asks again after a poll interval (a worker that stops when empty stops instead). Default: true.

Source

fn attempted(&self, attempt: &Attempt)

Told after each attempt, whatever its outcome.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§