pub struct FrontingConfig { /* private fields */ }Expand description
Configuration for FrontPolicy::ConfiguredRetry. A domain is considered “failed” once it
has failed failures_per_domain times; fronting is enabled once num_domains_failed distinct
domains have failed.
Both thresholds are inclusive (>=), so 0 is a valid, well-defined value for either field
rather than an error - it simply means the threshold is already satisfied:
failures_per_domain: 0- a domain counts as “failed” on its very first failure.num_domains_failed: 0- fronting is enabled as soon asretry_enableis called with a domain, even before any domain has reachedfailures_per_domain. This makesfailures_per_domainirrelevant, so settingnum_domains_failedto0alongside a non-zerofailures_per_domainis almost certainly a configuration mistake - useFrontPolicy::OnRetryinstead if “enable on the first failure” is actually what’s wanted.FrontingConfig::default()(both0) therefore enables fronting on the very first failure seen, same asnum_domains_failed: 0above.
Implementations§
Source§impl FrontingConfig
impl FrontingConfig
Sourcepub fn new(failures_per_domain: usize, num_domains_failed: usize) -> Self
pub fn new(failures_per_domain: usize, num_domains_failed: usize) -> Self
Create a new configuration for FrontPolicy::ConfiguredRetry.
Sourcepub fn with_failures_per_domain(self, failures_per_domain: usize) -> Self
pub fn with_failures_per_domain(self, failures_per_domain: usize) -> Self
Set the number of failures allowed for a single domain before it is considered failed.
Sourcepub fn with_num_domains_failed(self, num_domains_failed: usize) -> Self
pub fn with_num_domains_failed(self, num_domains_failed: usize) -> Self
Set the number of distinct domains that must fail before fronting is enabled.
Sourcepub fn with_include_non_fronted_in_rotation(self, include: bool) -> Self
pub fn with_include_non_fronted_in_rotation(self, include: bool) -> Self
Once fronting is enabled, allow domains without a configured front to still be selected when rotating hosts (rather than only rotating between fronted domains).
Sourcepub fn with_disable_fronting_on_non_fronting_success(
self,
disable: bool,
) -> Self
pub fn with_disable_fronting_on_non_fronting_success( self, disable: bool, ) -> Self
Requires Self::with_include_non_fronted_in_rotation to also be set. When a request
against a non-fronted domain succeeds while fronting is enabled, reset the accumulated
failure counts and disable fronting again, letting the client rely less on fronting once
it is no longer needed.
Trait Implementations§
Source§impl Clone for FrontingConfig
impl Clone for FrontingConfig
Source§impl Debug for FrontingConfig
impl Debug for FrontingConfig
Source§impl Default for FrontingConfig
impl Default for FrontingConfig
Source§impl PartialEq for FrontingConfig
impl PartialEq for FrontingConfig
impl StructuralPartialEq for FrontingConfig
Auto Trait Implementations§
impl Freeze for FrontingConfig
impl RefUnwindSafe for FrontingConfig
impl Send for FrontingConfig
impl Sync for FrontingConfig
impl Unpin for FrontingConfig
impl UnsafeUnpin for FrontingConfig
impl UnwindSafe for FrontingConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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