pub struct DeliveryContext { /* private fields */ }Expand description
Per-delivery identity, created once per queued item and reused on every retry attempt.
The worker creates one of these before the retry loop and hands the same reference to the sink on each attempt. A sink that derives request identity from it (today, a signed webhook) therefore reproduces a byte-identical id, timestamp, and signature when a delivery is retried, which is what lets a receiver dedupe redeliveries and enforce a replay window.
The id and timestamp are computed lazily on first access: most deliveries go to sinks that never read them (stdout, file, NATS, OTLP), so the worker pays no per-item RNG call or allocation unless a sink actually signs. The first access (the first signing attempt) fixes the value, and every retry reuses the same one.
Implementations§
Source§impl DeliveryContext
impl DeliveryContext
Sourcepub fn id_base(&self) -> &str
pub fn id_base(&self) -> &str
Stable base id for this delivery (msg_<uuid>). A sink may append a
per-result suffix to address individual results within one batch.
Sourcepub fn first_attempt(&self) -> SystemTime
pub fn first_attempt(&self) -> SystemTime
Wall-clock time of the first access (the first delivery attempt that reads the context); used as the signed timestamp.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DeliveryContext
impl RefUnwindSafe for DeliveryContext
impl Send for DeliveryContext
impl Sync for DeliveryContext
impl Unpin for DeliveryContext
impl UnsafeUnpin for DeliveryContext
impl UnwindSafe for DeliveryContext
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
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