Skip to main content

AsyncConfigProvider

Trait AsyncConfigProvider 

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

    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Config>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn save<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 Self::Config,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn validate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 Self::Config,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn default_config<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Self::Config> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn watch_changes<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Self::Config>> + Send + 'static>>>> + Send + 'async_trait>>
       where Self::Config: 'static,
             Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn reload<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Config>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Async configuration management abstraction for non-blocking configuration operations

§Async Version

This trait provides async operations for configuration management with better I/O handling.

Required Associated Types§

Source

type Config: Send + Sync

The configuration type this provider handles

Source

type Error: Error + Send + Sync + 'static

The error type returned by configuration operations

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Config>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load configuration from source

Source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 Self::Config, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save configuration to source

Source

fn validate<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 Self::Config, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate configuration

Source

fn default_config<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Self::Config> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get default configuration

Provided Methods§

Source

fn watch_changes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Self::Config>> + Send + 'static>>>> + Send + 'async_trait>>
where Self::Config: 'static, Self: 'async_trait, 'life0: 'async_trait,

Watch for configuration changes

Source

fn reload<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Config>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reload configuration from source

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Health check for configuration source

Implementors§