pub struct ResolverChain { /* private fields */ }Expand description
The resolver chain itself.
Clone-cheap (everything sits behind Arcs) so callers can pass it
to spawned tasks freely.
Implementations§
Source§impl ResolverChain
impl ResolverChain
Sourcepub fn new(resolvers: Vec<Arc<dyn AgentResolver>>) -> Self
pub fn new(resolvers: Vec<Arc<dyn AgentResolver>>) -> Self
Construct a chain from a set of resolvers — one per scheme.
Two resolvers with the same scheme: the last one wins. That’s useful at test time but a logical error in production; callers should ensure scheme uniqueness when wiring providers.
Sourcepub fn with_capacity(
resolvers: Vec<Arc<dyn AgentResolver>>,
capacity: usize,
ttl: Duration,
) -> Self
pub fn with_capacity( resolvers: Vec<Arc<dyn AgentResolver>>, capacity: usize, ttl: Duration, ) -> Self
Like new but with caller-supplied capacity and
TTL. Mostly for tests; production uses DEFAULT_TTL and
DEFAULT_CAPACITY.
Sourcepub async fn resolve(
&self,
handle: &str,
) -> Result<ResolvedAgent, ResolverError>
pub async fn resolve( &self, handle: &str, ) -> Result<ResolvedAgent, ResolverError>
Resolve a handle, returning a fresh-or-cached ResolvedAgent.
Steps:
- Cache hit, fresh (
age < ttl) → return immediately. - Cache hit, stale (
age >= ttl) → conditional GET; on 304 extend TTL and serve cached record; on fresh fetch update. - Cache miss → single-flight: first caller fetches; other
concurrent callers wait on a
Notifythen re-read the cache.
Sourcepub async fn invalidate(&self, handle: &str) -> Result<(), ResolverError>
pub async fn invalidate(&self, handle: &str) -> Result<(), ResolverError>
Force eviction of a handle from the cache. Used when an external signal (rotation event, revoke) renders the cached record stale.
Trait Implementations§
Source§impl Clone for ResolverChain
impl Clone for ResolverChain
Source§fn clone(&self) -> ResolverChain
fn clone(&self) -> ResolverChain
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ResolverChain
impl !RefUnwindSafe for ResolverChain
impl Send for ResolverChain
impl Sync for ResolverChain
impl Unpin for ResolverChain
impl UnsafeUnpin for ResolverChain
impl !UnwindSafe for ResolverChain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more