pub struct CallPolicy {
pub deadline: Option<Duration>,
pub max_attempts: u32,
pub base_backoff: Duration,
pub idempotent: bool,
}Expand description
Per-call deadline and retry policy.
Retries are bounded and only ever applied where the caller has said the
operation is safe to repeat — see CallPolicy::idempotent.
Fields§
§deadline: Option<Duration>§max_attempts: u32§base_backoff: Duration§idempotent: boolWhether the operation may be safely repeated. Defaults to false: a
blanket retry on a mutation is how one payment becomes two.
Implementations§
Source§impl CallPolicy
impl CallPolicy
Sourcepub fn idempotent() -> Self
pub fn idempotent() -> Self
A read: safe to repeat.
Sourcepub fn from_contract(path: &str) -> Self
pub fn from_contract(path: &str) -> Self
The policy the CONTRACT implies for one RPC path.
This replaced a hand-written per-method judgement, which was wrong in both
directions: it refused to retry Upsert, Update and Delete even
though the broker declares them replayable, costing availability on a
transient failure the broker was happy to see again.
Deciding from the descriptor instead of a method name is the point of the
operation_kind annotation. An unknown path yields the conservative
default (no retries).
pub fn with_deadline(self, deadline: Duration) -> Self
pub fn with_max_attempts(self, attempts: u32) -> Self
Trait Implementations§
Source§impl Clone for CallPolicy
impl Clone for CallPolicy
Source§fn clone(&self) -> CallPolicy
fn clone(&self) -> CallPolicy
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 CallPolicy
Source§impl Debug for CallPolicy
impl Debug for CallPolicy
Auto Trait Implementations§
impl Freeze for CallPolicy
impl RefUnwindSafe for CallPolicy
impl Send for CallPolicy
impl Sync for CallPolicy
impl Unpin for CallPolicy
impl UnsafeUnpin for CallPolicy
impl UnwindSafe for CallPolicy
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request