Struct DnsLoadBalancerConfig
pub struct DnsLoadBalancerConfig<R = GlobalDnsResolver, P = RoundRobinPicker> {
pub resolver: R,
pub picker: P,
pub refresh_after: Duration,
pub evict_after_idle: Duration,
pub evict_after_stale: Duration,
pub mode: DnsResolveIpMode,
pub max_entries: u64,
}dns only.Expand description
DNS loadbalancer config used by DnsLoadBalancerLayer and DnsLoadBalancer.
Fields§
§resolver: RDnsAddressResolver that will resolve IPs for the given host
WARNING: it is possible that the underlying resolver also has caching of its own. So definetely check the docs and tweak the config if needed so it works together with the caching logic in this loadbalancer.
picker: PDnsIpPicker that will decide which IP to use
refresh_after: DurationA cached resolution older than this triggers a background refresh (the stale value is still served while it refreshes)
evict_after_idle: DurationA cache entry that hasn’t been accessed for this long is dropped from the cache.
evict_after_stale: DurationA cache entry whose last successful refresh was longer than this ago is dropped
Protects against serving stale data when refreshes keep failing.
mode: DnsResolveIpModeIp resolve mode that will be used by resolver
max_entries: u64Max amount of entries that will be stored in cache
Implementations§
§impl DnsLoadBalancerConfig
impl DnsLoadBalancerConfig
pub fn new() -> DnsLoadBalancerConfig
pub fn new() -> DnsLoadBalancerConfig
Default config: global DNS resolver, round-robin picker,
DEFAULT_LB_REFRESH_AFTER, DEFAULT_LB_EVICT_AFTER_IDLE,
DEFAULT_LB_EVICT_AFTER_STALE, DEFAULT_LB_MAX_ENTRIES.
§impl<R, P> DnsLoadBalancerConfig<R, P>
impl<R, P> DnsLoadBalancerConfig<R, P>
pub fn from_parts(resolver: R, picker: P) -> DnsLoadBalancerConfig<R, P>
pub fn from_parts(resolver: R, picker: P) -> DnsLoadBalancerConfig<R, P>
Build a config with a custom resolver and picker, defaults for everything else.
Combine with struct update syntax to tweak individual fields:
DnsLoadBalancerConfig {
refresh_after: Duration::from_secs(60),
..DnsLoadBalancerConfig::from_parts(my_resolver, my_picker)
}Trait Implementations§
§impl<R, P> Clone for DnsLoadBalancerConfig<R, P>
impl<R, P> Clone for DnsLoadBalancerConfig<R, P>
§fn clone(&self) -> DnsLoadBalancerConfig<R, P>
fn clone(&self) -> DnsLoadBalancerConfig<R, P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Default for DnsLoadBalancerConfig
impl Default for DnsLoadBalancerConfig
§fn default() -> DnsLoadBalancerConfig
fn default() -> DnsLoadBalancerConfig
Auto Trait Implementations§
impl<R, P> Freeze for DnsLoadBalancerConfig<R, P>
impl<R, P> RefUnwindSafe for DnsLoadBalancerConfig<R, P>where
R: RefUnwindSafe,
P: RefUnwindSafe,
impl<R, P> Send for DnsLoadBalancerConfig<R, P>
impl<R, P> Sync for DnsLoadBalancerConfig<R, P>
impl<R, P> Unpin for DnsLoadBalancerConfig<R, P>
impl<R, P> UnsafeUnpin for DnsLoadBalancerConfig<R, P>where
R: UnsafeUnpin,
P: UnsafeUnpin,
impl<R, P> UnwindSafe for DnsLoadBalancerConfig<R, P>where
R: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writer§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer