Skip to main content

DesiredTaskCountHandler

Trait DesiredTaskCountHandler 

Source
pub trait DesiredTaskCountHandler:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ev: DesiredTaskCountEvent<'life1>,
    ) -> Pin<Box<dyn Future<Output = Option<Result<DesiredTaskCountEventResponse>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, ev: DesiredTaskCountEvent<'life1>, ) -> Pin<Box<dyn Future<Output = Option<Result<DesiredTaskCountEventResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Function applied to each node that returns a DesiredTaskCountEventResponse hinting how many tasks should be used in the [Stage] containing that node, or an error if the hint cannot be determined.

Handlers are asynchronous and may await metadata or external services. Handler functions return a [DesiredTaskCountFuture] so their futures can borrow from the event.

All the [TaskEstimator] registered in the session will be applied to the node until one returns an estimation.

If no estimation is returned from any of the registered [TaskEstimator]s, then:

  • If the node is a leaf node,Maximum(1) is assumed, hinting the distributed planner that the leaf node cannot be distributed across tasks.
  • If the node is a normal node in the plan, then the maximum task count from its children is inherited.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl DesiredTaskCountHandler for Arc<dyn DesiredTaskCountHandler>

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, ev: DesiredTaskCountEvent<'life1>, ) -> Pin<Box<dyn Future<Output = Option<Result<DesiredTaskCountEventResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl DesiredTaskCountHandler for usize

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, ev: DesiredTaskCountEvent<'life1>, ) -> Pin<Box<dyn Future<Output = Option<Result<DesiredTaskCountEventResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§