PendingOutboundStore

Sent application messages kept until the recipient acknowledges them, so they can be encrypted and sent again. Keyed by (recipient, logical ID).

Holds application plaintext (encrypted at rest by persistent adapters, see docs/storage-encryption.md). Entries are removed when the acknowledgement arrives or the application abandons them, never because the transport accepted an envelope.

Functions

Link copied to clipboard
abstract suspend fun count(recipient: DeviceAddress? = null): Long

The number of pending messages, to recipient only if given. Never opens a stored record.

Link copied to clipboard
abstract suspend fun get(recipient: DeviceAddress, id: LogicalMessageId): PendingOutboundMessage?
Link copied to clipboard
abstract suspend fun page(afterSequence: Long, limit: Int, recipient: DeviceAddress? = null): List<PendingOutboundMessage>

At most limit pending messages with a sequence number greater than afterSequence, to recipient only if given, in ascending PendingOutboundMessage.sequence order (docs/outbound-message-lifecycle.md). Opens only the records it returns. Throws IllegalArgumentException if limit is not positive or afterSequence is negative.

Link copied to clipboard
abstract suspend fun remove(recipient: DeviceAddress, id: LogicalMessageId): Boolean

Removes exactly this entry (acknowledged, or abandoned by the application) without opening it; returns false if it was not pending. Removal never lowers the sequence counter.

Link copied to clipboard
abstract suspend fun store(recipient: DeviceAddress, id: LogicalMessageId, frame: ByteArray): Long

Stores frame for recipient and returns its sequence number. Sequence numbers increase with every call and are never reused, also after removals and restarts. Throws IllegalArgumentException if id is already pending for recipient.