pub struct ApplicationService { /* private fields */ }Expand description
Named group of providers with per-provider breakers.
The first registered provider becomes the preferred one. New providers start with a breaker threshold of 5 failures and a 60-second reset timeout.
Implementations§
Source§impl ApplicationService
impl ApplicationService
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates an empty service group with the given name.
Sourcepub fn register_provider<P: ServiceProvider + 'static>(&mut self, provider: P)
pub fn register_provider<P: ServiceProvider + 'static>(&mut self, provider: P)
Registers a provider with a fresh circuit breaker.
P is the concrete ServiceProvider implementation being stored.
Sourcepub fn get_provider_by_name(
&self,
name: &str,
) -> Option<Arc<dyn ServiceProvider>>
pub fn get_provider_by_name( &self, name: &str, ) -> Option<Arc<dyn ServiceProvider>>
Returns the provider with the given name, if registered.
Sourcepub fn provider_names(&self) -> Vec<String>
pub fn provider_names(&self) -> Vec<String>
Returns the names of all registered providers in registration order.
Sourcepub fn available(&self) -> Option<Arc<dyn ServiceProvider>>
pub fn available(&self) -> Option<Arc<dyn ServiceProvider>>
Returns the first provider whose breaker is closed.
A provider signaling healthy via is_healthy
has its breaker reset and is returned. Returns None when no provider
is currently usable.
Auto Trait Implementations§
impl !RefUnwindSafe for ApplicationService
impl !UnwindSafe for ApplicationService
impl Freeze for ApplicationService
impl Send for ApplicationService
impl Sync for ApplicationService
impl Unpin for ApplicationService
impl UnsafeUnpin for ApplicationService
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more