pub trait DeliverySink: Send + 'static {
// Required methods
fn deliver<'a>(
&'a mut self,
result: &'a ProcessResult,
ctx: &'a DeliveryContext,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'a>>;
fn label(&self) -> &'static str;
// Provided method
fn deliver_incident<'a>(
&'a mut self,
_incident: &'a IncidentEnvelope,
_ctx: &'a DeliveryContext,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'a>> { ... }
}Expand description
A sink the delivery layer can drive: deliver one result, identify itself.
Implemented for the concrete crate::io::Sink enum; generic so the worker
can be unit-tested against a mock without a test-only enum variant.
Required Methods§
Sourcefn deliver<'a>(
&'a mut self,
result: &'a ProcessResult,
ctx: &'a DeliveryContext,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'a>>
fn deliver<'a>( &'a mut self, result: &'a ProcessResult, ctx: &'a DeliveryContext, ) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'a>>
Deliver a single result, returning an error the worker may retry.
ctx is minted once per queued item and handed back unchanged on every
retry, so a sink that derives request identity from it (e.g. a signed
webhook) reproduces the same id, timestamp, and signature on a re-send.
Provided Methods§
Sourcefn deliver_incident<'a>(
&'a mut self,
_incident: &'a IncidentEnvelope,
_ctx: &'a DeliveryContext,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'a>>
fn deliver_incident<'a>( &'a mut self, _incident: &'a IncidentEnvelope, _ctx: &'a DeliveryContext, ) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'a>>
Deliver a single incident line. Defaults to a no-op so mock sinks and any sink that does not carry incidents need no implementation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".