Skip to main content

DeliverySink

Trait DeliverySink 

Source
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§

Source

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.

Source

fn label(&self) -> &'static str

Short, stable label used for structured logs and per-sink metrics.

Provided Methods§

Source

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".

Implementors§