pub trait Policy: Sized {
type CacheItem;
type Ordering: Iterator<Item = usize>;
// Required methods
fn refresh_cache<'life0, 'life1, 'async_trait, Resolver>(
&'life0 self,
client: &'life1 SrvClient<Resolver, Self>,
) -> Pin<Box<dyn Future<Output = Result<Cache<Self::CacheItem>, Error<Resolver::Error>>> + Send + 'async_trait>>
where Resolver: 'async_trait + SrvResolver,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn order(&self, items: &[Self::CacheItem]) -> Self::Ordering;
fn cache_item_to_uri(item: &Self::CacheItem) -> &Uri;
// Provided methods
fn note_success(&self, uri: &Uri) { ... }
fn note_failure(&self, uri: &Uri) { ... }
}
Expand description
Policy for SrvClient
to use when selecting SRV targets to recommend.
Required Associated Types§
Required Methods§
Sourcefn refresh_cache<'life0, 'life1, 'async_trait, Resolver>(
&'life0 self,
client: &'life1 SrvClient<Resolver, Self>,
) -> Pin<Box<dyn Future<Output = Result<Cache<Self::CacheItem>, Error<Resolver::Error>>> + Send + 'async_trait>>where
Resolver: 'async_trait + SrvResolver,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn refresh_cache<'life0, 'life1, 'async_trait, Resolver>(
&'life0 self,
client: &'life1 SrvClient<Resolver, Self>,
) -> Pin<Box<dyn Future<Output = Result<Cache<Self::CacheItem>, Error<Resolver::Error>>> + Send + 'async_trait>>where
Resolver: 'async_trait + SrvResolver,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Obtains a refreshed cache for a client.
Sourcefn order(&self, items: &[Self::CacheItem]) -> Self::Ordering
fn order(&self, items: &[Self::CacheItem]) -> Self::Ordering
Creates an iterator of indices corresponding to cache items in the
order a SrvClient
should try using them to perform an operation.
Sourcefn cache_item_to_uri(item: &Self::CacheItem) -> &Uri
fn cache_item_to_uri(item: &Self::CacheItem) -> &Uri
Converts a reference to a cached item into a reference to a Uri
.
Provided Methods§
Sourcefn note_success(&self, uri: &Uri)
fn note_success(&self, uri: &Uri)
Makes any policy adjustments following a successful execution on uri
.
Sourcefn note_failure(&self, uri: &Uri)
fn note_failure(&self, uri: &Uri)
Makes any policy adjustments following a failed execution on uri
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.