PendingInboundStore

Received application messages kept until the application commits or discards them, so they can be delivered again, also after a restart. Keyed by (sender, logical ID).

Holds application plaintext (encrypted at rest by persistent adapters, see docs/storage-encryption.md). Entries are removed only when the application finalizes the message; nothing expires them.

Functions

Link copied to clipboard
abstract suspend fun contains(sender: DeviceAddress, id: LogicalMessageId): Boolean

Whether id from sender is pending. Never opens a stored record.

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

The number of pending messages, from sender only if given. Never opens a stored record.

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

At most limit pending messages with a sequence number greater than afterSequence, from sender only if given, in ascending PendingInboundMessage.sequence order (docs/message-discard.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(sender: DeviceAddress, id: LogicalMessageId): Boolean

Removes the entry; returns false if it was not pending.

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

Stores frame from sender 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 from sender.