Skip to main content

TemplateReloadTarget

Trait TemplateReloadTarget 

Source
pub trait TemplateReloadTarget: Send + Sync {
    // Required methods
    fn route_id(&self) -> &str;
    fn reload_timeout(&self) -> Duration;
    fn current_generation(&self) -> u64;
    fn build<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(Box<dyn TemplateReloadStaged>, u64), CamelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn commit(&self, staged: Box<dyn TemplateReloadStaged>);
}
Expand description

One reload target per registered template producer endpoint.

There is NO single-producer reload() on this trait — the only reload path is TemplateReloadRegistry::reload_route. commit is infallible (()) because it is only ever reached after reload_route has validated every staged generation, so all-or-nothing holds structurally.

Required Methods§

Source

fn route_id(&self) -> &str

Route id this target serves.

Source

fn reload_timeout(&self) -> Duration

Per-target deadline for a reload. reload_route uses the TIGHTEST (minimum) across all targets for the route, so registration order does not define the route deadline.

Source

fn current_generation(&self) -> u64

Current committed generation (bumped on each successful commit).

Source

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

Build a staged set against the current sources. Returns the staged set and the generation read at build time. May fail (invalid source); the prior set is retained on failure.

Source

fn commit(&self, staged: Box<dyn TemplateReloadStaged>)

Commit a previously-built staged set (infallible). Only called by reload_route after validation, so no recheck is needed here.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§