The delivery state of a queued message: its envelope, plus the
Sovite.Queue.Records appended so far, replayed in order.
Each recipient is :pending (never tried), :deferred, :delivered,
or :failed. Final states never change, so a record replayed after a
crash cannot bring a delivered recipient back.
notified tells whether the sender was told about a recipient's
failure or (when it asked with NOTIFY=SUCCESS) its delivery, or
about an alias of expanded.
Summary
Functions
Applies one record. Records for unknown recipients are ignored.
Returns true when every recipient is delivered or failed.
Builds the state from an envelope and its records.
Whether a notification of kind is due for address by its NOTIFY
parameter (RFC 3461 §4.1). Without one, failures and delays are
reported, and successes are not. :relay is anything but NEVER.
Recipients still to be delivered (pending or deferred), in envelope order.
Aliases of expanded the sender was not told about yet.
Failed recipients the sender has not been told about, with their details.
Delivered recipients whose delivery the sender asked to know about
(NOTIFY=SUCCESS, or report in the details unless NOTIFY=NEVER)
and was not told yet, with their details. Only those with an action
in their details: the others went to a server that tells the sender
itself.
Recipients with status, in envelope order.
Types
@type recipient() :: %{ status: :pending | Sovite.Queue.Record.status(), details: Sovite.Queue.Record.details() | nil, notified: boolean() }
The state of one recipient.
@type t() :: %Sovite.Queue.Entry{ attempts: non_neg_integer(), envelope: Sovite.Queue.Envelope.t(), expansions: %{required(String.t()) => boolean()}, next_attempt: DateTime.t() | nil, recipients: %{required(String.t()) => recipient()}, warned: boolean() }
Functions
@spec apply_record(t(), Sovite.Queue.Record.t()) :: t()
Applies one record. Records for unknown recipients are ignored.
Returns true when every recipient is delivered or failed.
@spec new(Sovite.Queue.Envelope.t(), [Sovite.Queue.Record.t()]) :: t()
Builds the state from an envelope and its records.
Whether a notification of kind is due for address by its NOTIFY
parameter (RFC 3461 §4.1). Without one, failures and delays are
reported, and successes are not. :relay is anything but NEVER.
Recipients still to be delivered (pending or deferred), in envelope order.
Aliases of expanded the sender was not told about yet.
@spec unnotified_failures(t()) :: [{String.t(), Sovite.Queue.Record.details()}]
Failed recipients the sender has not been told about, with their details.
@spec unnotified_successes(t()) :: [{String.t(), Sovite.Queue.Record.details()}]
Delivered recipients whose delivery the sender asked to know about
(NOTIFY=SUCCESS, or report in the details unless NOTIFY=NEVER)
and was not told yet, with their details. Only those with an action
in their details: the others went to a server that tells the sender
itself.
@spec with_status( t(), Sovite.Queue.Record.status() | :pending | [Sovite.Queue.Record.status() | :pending] ) :: [String.t()]
Recipients with status, in envelope order.