Skip to main content

UpstreamProvider

Trait UpstreamProvider 

Source
pub trait UpstreamProvider: Send + Sync {
    // Required methods
    fn get(&self, name: &str) -> Option<Arc<Upstream>>;
    fn list(&self) -> Vec<(String, Arc<Upstream>)>;

    // Provided methods
    fn healthy_status(&self) -> HashMap<String, UpstreamHealthyStatus> { ... }
    fn get_all_stats(&self) -> HashMap<String, UpstreamStats> { ... }
}
Expand description

Upstream provider trait

Required Methods§

Source

fn get(&self, name: &str) -> Option<Arc<Upstream>>

Get an upstream by name

§Arguments
  • name - The name of the upstream to get
§Returns
  • Option<Arc<Upstream>> - The upstream if found, None otherwise
Source

fn list(&self) -> Vec<(String, Arc<Upstream>)>

Get the list of upstreams

§Returns
  • Vec<(String, Arc<Upstream>)> - The list of upstreams

Provided Methods§

Source

fn healthy_status(&self) -> HashMap<String, UpstreamHealthyStatus>

Get the healthy status of all upstreams

§Returns
  • HashMap<String, UpstreamHealthyStatus> - Healthy status of all upstreams

This function iterates through all upstreams and checks their health status.

Source

fn get_all_stats(&self) -> HashMap<String, UpstreamStats>

Get the stats of all upstreams

§Returns
  • HashMap<String, UpstreamStats> - Stats of all upstreams

Implementors§