Skip to main content

Reloadable

Trait Reloadable 

Source
pub trait Reloadable<S>:
    Send
    + Sync
    + 'static {
    // Required method
    fn reload<'life0, 'life1, 'async_trait>(
        &'life0 self,
        state: &'life1 S,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn priority(&self) -> Option<u8> { ... }
}
Expand description

Anything that can hot-reload itself when config changes.

reload() is the same shape as Provider::boot() — re-read the on-disk config (use tokio::fs, never std::fs in this async path) and rebuild the runtime snapshot, publishing it through an ArcSwap so in-flight requests/connections see the swap atomically. Reload must NOT change which providers are registered; it only refreshes state of an already-registered provider.

Required Methods§

Source

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

Perform a synchronous reload using the current shared state. Implementations may spawn async work internally if needed.

Provided Methods§

Source

fn priority(&self) -> Option<u8>

Optional reload priority.

Lower values run earlier. None means priority::NORMAL.

Implementors§