Skip to main content

KeySelectorLayer

Trait KeySelectorLayer 

Source
pub trait KeySelectorLayer: Send + Sync {
    // Required methods
    fn select<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        provider: &'life1 str,
        keys: &'life2 [ApiKeyState],
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn mark_failed(&self, provider: &str, index: usize);
    fn mark_success(&self, provider: &str, index: usize);
}

Required Methods§

Source

fn select<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, provider: &'life1 str, keys: &'life2 [ApiKeyState], ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Pick one key from the list.

Source

fn mark_failed(&self, provider: &str, index: usize)

Mark a key as failed (e.g. 401, 429).

Source

fn mark_success(&self, provider: &str, index: usize)

Mark a key as successful.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§