Skip to main content

RouteTasksHandler

Trait RouteTasksHandler 

Source
pub trait RouteTasksHandler:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle(
        &self,
        ev: RouteTasksEvent<'_>,
    ) -> Option<Result<RouteTasksEventResponse>>;
}
Expand description

Optionally assigns a stage’s task slots to worker URLs.

Handlers are evaluated in reverse registration order. Return Some(Ok(_)) to select a complete routing response and stop dispatch, or None to defer to earlier handlers. If every handler returns None, the coordinator assigns the tasks round-robin, from a randomized worker offset. Returning Some(Err(_)) aborts execution before tasks are submitted.

Required Methods§

Source

fn handle( &self, ev: RouteTasksEvent<'_>, ) -> Option<Result<RouteTasksEventResponse>>

Optionally assigns the tasks described by ev to specific worker URLs.

Return None when this handler does not apply. A successful response must provide exactly one URL for every task, in task-index order.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl RouteTasksHandler for Arc<dyn RouteTasksHandler>

Implementors§

Source§

impl<F> RouteTasksHandler for F
where F: Send + Sync + 'static + for<'a> Fn(RouteTasksEvent<'a>) -> Option<Result<RouteTasksEventResponse>>,