Skip to main content

LoadSignal

Trait LoadSignal 

Source
pub trait LoadSignal:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn overload_threshold(&self) -> f32;
    fn sample(&self, window: Duration) -> Vec<LoadSnapshot>;

    // Provided methods
    fn start<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), CrawlError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn stop<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), CrawlError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A source of recent system or client load observations.

Required Methods§

Source

fn name(&self) -> &str

Returns the stable name of this signal.

Source

fn overload_threshold(&self) -> f32

Returns the utilization threshold at which this signal is overloaded.

Source

fn sample(&self, window: Duration) -> Vec<LoadSnapshot>

Returns observations from the requested recent window.

Provided Methods§

Source

fn start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), CrawlError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Starts any sampling work required by this signal.

Source

fn stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), CrawlError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stops any sampling work required by this signal.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§