AsyncConnectionStrategy

Trait AsyncConnectionStrategy 

Source
pub trait AsyncConnectionStrategy: Send + Sync {
    // Required methods
    fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        targets: &'life1 [Target],
        checker: &'life2 dyn AsyncTargetChecker,
        config: &'life3 WaitConfig,
    ) -> Pin<Box<dyn Future<Output = Result<WaitResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn name(&self) -> &'static str;

    // Provided method
    fn execute_streaming<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        targets: &'life1 [Target],
        checker: &'life2 dyn AsyncTargetChecker,
        config: &'life3 WaitConfig,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TargetResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Async trait for connection strategies

This allows for custom concurrency patterns beyond the built-in “all” and “any” strategies.

Required Methods§

Source

fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, targets: &'life1 [Target], checker: &'life2 dyn AsyncTargetChecker, config: &'life3 WaitConfig, ) -> Pin<Box<dyn Future<Output = Result<WaitResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute the connection strategy for multiple targets

Source

fn name(&self) -> &'static str

Get strategy name

Provided Methods§

Source

fn execute_streaming<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, targets: &'life1 [Target], checker: &'life2 dyn AsyncTargetChecker, config: &'life3 WaitConfig, ) -> Pin<Box<dyn Future<Output = Result<Vec<TargetResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute strategy with streaming results for real-time progress

Note: This is a simpler approach that returns a future of results. For true streaming behavior, use the execute method with custom logic.

Implementors§