Skip to main content

ResolverHooks

Trait ResolverHooks 

Source
pub trait ResolverHooks: Send + Sync {
    // Provided methods
    fn on_progress<'life0, 'async_trait>(
        &'life0 self,
        _event: ProgressEvent,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_cache_hit<'life0, 'async_trait>(
        &'life0 self,
        _event: CacheHitEvent,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_cache_miss<'life0, 'async_trait>(
        &'life0 self,
        _event: CacheMissEvent,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_error<'life0, 'async_trait>(
        &'life0 self,
        _event: ErrorEvent,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Observability trait. Consumers implement only the methods they care about; every default is a no-op so partial impls are zero-cost.

All methods are async so consumers can await inside (e.g. forwarding to an async telemetry sink). Return type is () because the resolver fires events fire-and-forget — there’s no path for hook errors to propagate back. Hook impls should catch their own errors internally.

§Safety contract

  • Hooks must not panic (see module-level docs).
  • Hooks must not acquire any lock the resolver holds (deadlock risk).
  • Hooks must not call back into the resolver (re-entry is undefined).

Provided Methods§

Source

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

Generic progress notification.

Source

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

Cache hit at any tier.

Source

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

Cache miss at every tier (or expired entry forcing re-fetch).

Source

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

Provider or transform error. Note: hook fires per-source for NamedMap shapes even though only the first error bubbles up to the caller as the user-facing ChartError.

Implementors§