#[non_exhaustive]pub struct ResumePolicy {
pub attempts: u32,
pub backoff: Duration,
pub max_backoff: Duration,
pub deadline: Duration,
pub healthy_after: Duration,
pub jitter: bool,
}Expand description
How a Delegation tries to get its stream back before it gives up on
the child. The default is five attempts, 200 ms apart at first and
doubling to 5 s, inside 30 s in all.
An attempt that gets a stream and then loses it without the position moving counts as spent: a server that accepts a subscription and drops it at once exhausts the policy rather than being asked for ever. A stream that delivered events (the position advanced) starts the count again.
Positions come from the agent’s event ids. An agent that sends none (gRPC
and WebSocket streams carry none) shows no progress that way, so a stream
also counts as having worked when it delivered at least one event and
stayed open for healthy_after: a long, quiet
child cut again and again by an idle timeout is not given up on, while a
server that accepts a subscription, sends its snapshot and drops it at
once still exhausts the policy.
The waits between attempts are spread by up to half
(with_jitter), so that a fleet whose streams a
proxy rollout cut in the same instant does not come back in the same
instant.
ResumePolicy::none restores the behaviour before 2026-10-31: the first
loss cancels the child.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.attempts: u32How many times in a row to reopen the stream. Zero never resumes.
backoff: DurationThe wait before the second attempt; each later wait doubles.
max_backoff: DurationThe longest a wait between attempts grows to.
deadline: DurationThe longest one loss is worked on, from the loss to giving up.
healthy_after: DurationHow long a reopened stream must stay open, having delivered an event, to count as one that worked and start the attempt count again.
jitter: boolWhether each wait between attempts is shortened by a random fraction of up to half.
Implementations§
Source§impl ResumePolicy
impl ResumePolicy
Sourcepub const fn none() -> ResumePolicy
pub const fn none() -> ResumePolicy
Never resumes: the first lost stream cancels the child.
Sourcepub const fn with_attempts(self, attempts: u32) -> ResumePolicy
pub const fn with_attempts(self, attempts: u32) -> ResumePolicy
Sets how many times in a row the stream is reopened.
Sourcepub const fn with_backoff(
self,
first: Duration,
longest: Duration,
) -> ResumePolicy
pub const fn with_backoff( self, first: Duration, longest: Duration, ) -> ResumePolicy
Sets the first wait between attempts and the longest one.
Sourcepub const fn with_deadline(self, deadline: Duration) -> ResumePolicy
pub const fn with_deadline(self, deadline: Duration) -> ResumePolicy
Sets how long one loss is worked on.
Sourcepub const fn with_healthy_after(self, healthy_after: Duration) -> ResumePolicy
pub const fn with_healthy_after(self, healthy_after: Duration) -> ResumePolicy
Sets how long a reopened stream must stay open, having delivered an event, to count as one that worked.
Sourcepub const fn with_jitter(self, jitter: bool) -> ResumePolicy
pub const fn with_jitter(self, jitter: bool) -> ResumePolicy
Sets whether each wait between attempts is shortened by a random fraction of up to half. On by default; a test that pins the waits turns it off.
Trait Implementations§
Source§impl Clone for ResumePolicy
impl Clone for ResumePolicy
Source§fn clone(&self) -> ResumePolicy
fn clone(&self) -> ResumePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ResumePolicy
Source§impl Debug for ResumePolicy
impl Debug for ResumePolicy
Source§impl Default for ResumePolicy
impl Default for ResumePolicy
Source§fn default() -> ResumePolicy
fn default() -> ResumePolicy
impl Eq for ResumePolicy
Source§impl PartialEq for ResumePolicy
impl PartialEq for ResumePolicy
impl StructuralPartialEq for ResumePolicy
Auto Trait Implementations§
impl Forget for ResumePolicy
impl Freeze for ResumePolicy
impl Move for ResumePolicy
impl RefUnwindSafe for ResumePolicy
impl Send for ResumePolicy
impl Sync for ResumePolicy
impl Unpin for ResumePolicy
impl UnsafeUnpin for ResumePolicy
impl UnwindSafe for ResumePolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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 tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].