KeyPoolStorage

Trait KeyPoolStorage 

Source
pub trait KeyPoolStorage: Send + Sync {
    type Key: ApiKey;
    type Domain: KeyDomain;
    type Error: KeyPoolError;

    // Required methods
    fn acquire_key<S>(
        &self,
        selector: S,
    ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
    fn acquire_many_keys<S>(
        &self,
        selector: S,
        number: i64,
    ) -> impl Future<Output = Result<Vec<Self::Key>, Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
    fn store_key(
        &self,
        user_id: i32,
        key: String,
        domains: Vec<Self::Domain>,
    ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send;
    fn read_key<S>(
        &self,
        selector: S,
    ) -> impl Future<Output = Result<Option<Self::Key>, Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
    fn read_keys<S>(
        &self,
        selector: S,
    ) -> impl Future<Output = Result<Vec<Self::Key>, Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
    fn remove_key<S>(
        &self,
        selector: S,
    ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
    fn add_domain_to_key<S>(
        &self,
        selector: S,
        domain: Self::Domain,
    ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
    fn remove_domain_from_key<S>(
        &self,
        selector: S,
        domain: Self::Domain,
    ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
    fn set_domains_for_key<S>(
        &self,
        selector: S,
        domains: Vec<Self::Domain>,
    ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
    fn timeout_key<S>(
        &self,
        selector: S,
        duration: Duration,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send
       where S: IntoSelector<Self::Key, Self::Domain>;
}

Required Associated Types§

Required Methods§

Source

fn acquire_key<S>( &self, selector: S, ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

Source

fn acquire_many_keys<S>( &self, selector: S, number: i64, ) -> impl Future<Output = Result<Vec<Self::Key>, Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

Source

fn store_key( &self, user_id: i32, key: String, domains: Vec<Self::Domain>, ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send

Source

fn read_key<S>( &self, selector: S, ) -> impl Future<Output = Result<Option<Self::Key>, Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

Source

fn read_keys<S>( &self, selector: S, ) -> impl Future<Output = Result<Vec<Self::Key>, Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

Source

fn remove_key<S>( &self, selector: S, ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

Source

fn add_domain_to_key<S>( &self, selector: S, domain: Self::Domain, ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

Source

fn remove_domain_from_key<S>( &self, selector: S, domain: Self::Domain, ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

Source

fn set_domains_for_key<S>( &self, selector: S, domains: Vec<Self::Domain>, ) -> impl Future<Output = Result<Self::Key, Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

Source

fn timeout_key<S>( &self, selector: S, duration: Duration, ) -> impl Future<Output = Result<(), Self::Error>> + Send
where S: IntoSelector<Self::Key, Self::Domain>,

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.

Implementors§