Amarula.Connection.Receive (amarula v0.4.0)

View Source

Pure parsers for the receive path of Amarula.Connection.

Most receive-side parsing already lives in dedicated modules (Receipt.parse, Presence.parse_update, MessageDecryptor), and the handlers that ack, decrypt, resolve acks, and emit events are socket/cipher/state-bound — they stay on Connection. This module holds the small pure decisions the ack/retry handlers make off a node: the <ack> outcome and the retry-receipt targets.

Summary

Functions

The outcome of a message <ack>: :ok when there's no error attr, or {:error, {:send_rejected, code}} when the server rejected the send.

The {msg_id, participant} a retry receipt targets. participant falls back to from when absent (a 1:1 retry). msg_id may be nil (caller skips).

Functions

ack_outcome(node)

@spec ack_outcome(term()) :: :ok | {:error, {:send_rejected, String.t()}}

The outcome of a message <ack>: :ok when there's no error attr, or {:error, {:send_rejected, code}} when the server rejected the send.

retry_targets(node)

@spec retry_targets(term()) :: {String.t() | nil, String.t() | nil}

The {msg_id, participant} a retry receipt targets. participant falls back to from when absent (a 1:1 retry). msg_id may be nil (caller skips).