rama_proxy

Trait ProxyDB

Source
pub trait ProxyDB:
    Send
    + Sync
    + 'static {
    type Error: Send + Sync + 'static;

    // Required method
    fn get_proxy_if(
        &self,
        ctx: TransportContext,
        filter: ProxyFilter,
        predicate: impl ProxyQueryPredicate,
    ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send + '_;

    // Provided method
    fn get_proxy(
        &self,
        ctx: TransportContext,
        filter: ProxyFilter,
    ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send + '_ { ... }
}
Expand description

The trait to implement to provide a proxy database to other facilities, such as connection pools, to provide a proxy based on the given TransportContext and ProxyFilter.

Required Associated Types§

Source

type Error: Send + Sync + 'static

The error type that can be returned by the proxy database

Examples are generic I/O issues or even more common if no proxy match could be found.

Required Methods§

Source

fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send + '_

Same as Self::get_proxy but with a predicate to filter out found proxies that do not match the given predicate.

Provided Methods§

Source

fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send + '_

Get a Proxy based on the given TransportContext and ProxyFilter, or return an error in case no Proxy could be returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ProxyDB for ()

Source§

type Error = OpaqueError

Source§

async fn get_proxy_if( &self, _ctx: TransportContext, _filter: ProxyFilter, _predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, _ctx: TransportContext, _filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<A, B> ProxyDB for Either<A, B>
where A: ProxyDB<Error: Into<BoxError>>, B: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = Box<dyn Error + Send + Sync>

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<A, B, C> ProxyDB for Either3<A, B, C>
where A: ProxyDB<Error: Into<BoxError>>, B: ProxyDB<Error: Into<BoxError>>, C: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = Box<dyn Error + Send + Sync>

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<A, B, C, D> ProxyDB for Either4<A, B, C, D>
where A: ProxyDB<Error: Into<BoxError>>, B: ProxyDB<Error: Into<BoxError>>, C: ProxyDB<Error: Into<BoxError>>, D: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = Box<dyn Error + Send + Sync>

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<A, B, C, D, E> ProxyDB for Either5<A, B, C, D, E>
where A: ProxyDB<Error: Into<BoxError>>, B: ProxyDB<Error: Into<BoxError>>, C: ProxyDB<Error: Into<BoxError>>, D: ProxyDB<Error: Into<BoxError>>, E: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = Box<dyn Error + Send + Sync>

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<A, B, C, D, E, F> ProxyDB for Either6<A, B, C, D, E, F>
where A: ProxyDB<Error: Into<BoxError>>, B: ProxyDB<Error: Into<BoxError>>, C: ProxyDB<Error: Into<BoxError>>, D: ProxyDB<Error: Into<BoxError>>, E: ProxyDB<Error: Into<BoxError>>, F: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = Box<dyn Error + Send + Sync>

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<A, B, C, D, E, F, G> ProxyDB for Either7<A, B, C, D, E, F, G>
where A: ProxyDB<Error: Into<BoxError>>, B: ProxyDB<Error: Into<BoxError>>, C: ProxyDB<Error: Into<BoxError>>, D: ProxyDB<Error: Into<BoxError>>, E: ProxyDB<Error: Into<BoxError>>, F: ProxyDB<Error: Into<BoxError>>, G: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = Box<dyn Error + Send + Sync>

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<A, B, C, D, E, F, G, H> ProxyDB for Either8<A, B, C, D, E, F, G, H>
where A: ProxyDB<Error: Into<BoxError>>, B: ProxyDB<Error: Into<BoxError>>, C: ProxyDB<Error: Into<BoxError>>, D: ProxyDB<Error: Into<BoxError>>, E: ProxyDB<Error: Into<BoxError>>, F: ProxyDB<Error: Into<BoxError>>, G: ProxyDB<Error: Into<BoxError>>, H: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = Box<dyn Error + Send + Sync>

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<A, B, C, D, E, F, G, H, I> ProxyDB for Either9<A, B, C, D, E, F, G, H, I>
where A: ProxyDB<Error: Into<BoxError>>, B: ProxyDB<Error: Into<BoxError>>, C: ProxyDB<Error: Into<BoxError>>, D: ProxyDB<Error: Into<BoxError>>, E: ProxyDB<Error: Into<BoxError>>, F: ProxyDB<Error: Into<BoxError>>, G: ProxyDB<Error: Into<BoxError>>, H: ProxyDB<Error: Into<BoxError>>, I: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = Box<dyn Error + Send + Sync>

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<T> ProxyDB for Option<T>
where T: ProxyDB<Error: Into<BoxError>>,

Source§

type Error = OpaqueError

Source§

async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>

Source§

async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>

Source§

impl<T> ProxyDB for Arc<T>
where T: ProxyDB,

Source§

type Error = <T as ProxyDB>::Error

Source§

fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send + '_

Source§

fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send + '_

Implementors§

Source§

impl ProxyDB for MemoryProxyDB

Available on crate feature memory-db only.
Source§

impl ProxyDB for Proxy

Source§

impl<T> ProxyDB for LiveUpdateProxyDB<T>
where T: ProxyDB<Error: Into<BoxError>>,

Available on crate feature live-update only.
Source§

type Error = Box<dyn Error + Send + Sync>