Skip to main content

Activator

Trait Activator 

Source
pub trait Activator: Send + Sync {
    // Required method
    fn activate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        service: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

On-demand activation hook for scale-to-zero services.

When the proxy resolves a route whose backend group currently has no healthy backends (the scale-to-zero idle state), it calls Activator::activate with the resolved load-balancer group name. The implementation is expected to trigger a scale-up (e.g. scale the service to its activation floor) and return once it has initiated the scale; the proxy then re-polls backend selection on a bounded backoff loop, forwarding the held request the moment a healthy backend appears.

Returning Err is non-fatal: the proxy logs it and falls through to the existing no-healthy-backends 503 path, so a flaky activator never blocks the request indefinitely beyond the proxy’s own deadline.

Required Methods§

Source

fn activate<'life0, 'life1, 'async_trait>( &'life0 self, service: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Trigger activation (scale-up) for the load-balancer group service.

service is the resolved LB group name (the same string passed to LoadBalancer::select), NOT necessarily the bare service name. Implementations that need the bare service name should derive it from this key.

§Errors

Returns a human-readable error string if activation could not be initiated. The proxy treats this as non-fatal and falls back to 503.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§