Skip to content

blackbull.mqtt.mailbox

blackbull.mqtt.mailbox

MQTT-private FIFO bounded by message count and retained wire-size charge.

The queue owns waiting messages, not the consumer's active message or the producer's single admission candidate. Closing wakes waiters without requiring room for a sentinel. No task is created for a blocked admission.

Mailbox

Bases: Queue[Message]

Actor inbox bounded by positive message-count and wire-byte budgets.

size_of charges queued wire bytes, not heap usage. MailboxTooLarge means a message cannot fit even when empty; QueueFull means put_nowait lacks current space, while put waits. close wakes all waiters without a sentinel. Puts then raise MailboxClosed; gets drain queued items before raising it unless close(discard=True) drops them. See docs/about/mqtt-actor-design.md for which actors may wait for space without deadlocking.

MailboxClosed

Bases: RuntimeError

The owner stopped accepting messages.

MailboxTooLarge

Bases: ValueError

A single message cannot fit the byte budget, even in an empty queue.