Skip to main content

Module deliverer

Module deliverer 

Source
Expand description

Sending activities through the queue.

Deliverer::send queues an activity for a set of inboxes and returns; Deliverer::run is the loop that sends what is queued, and the application spawns it on whatever runtime and in whatever task context it uses — Ojak does not spawn tasks of its own. Any number of loops may run, in any number of processes, over one queue.

A batch, such as moving every account’s followers, has to finish: Deliverer::send_batch tags each delivery so that the batch can be followed, and gives it a deadline, past which it is given up on rather than retried, so that one server that is down or too slow does not hold the batch open for as long as the retry policy would.

A portable inbox (FEP-ef61) has no host of its own, only the gateways its actor lists; Deliverer::send_portable queues it with them, and one attempt tries each in order until one accepts.

Structs§

Batch
What a batch of deliveries shares: a tag to find them by, when to give up on the ones that have not gone through, and what they are sent in order with.
CachingSenderKeys
SenderKeys that keeps each key inner gives for ttl after loading it, so that it is not loaded again for every delivery it signs.
CircuitBreaker
Holding back deliveries to a destination that keeps failing, rather than sending each one to fail in turn, as a Stoplight with its default strategies does.
Deliverer
Queues activities and sends them.
DelivererConfig
How the delivery loop behaves.
DeliveryAttempt
One attempt at a delivery, as it came out.
DeliveryFailure
A delivery that will not be tried again.
MemoryBreakers
Breakers in memory, each deliverer its own: the default.
PortableInbox
A portable actor’s inbox, and the gateways that accept deliveries to it, in the order its actor lists them.
Priority
Where sends to few inboxes go, and how few is few.
Probe
The right to probe a half-open breaker, which only one delivery holds at a time. What a store keeps in it — a lock it releases when it is dropped, say — is the store’s own.
Settled
A delivery that is done with, other than by running out of retries or its batch’s deadline: what Deliverer::on_settled is told.

Enums§

Admission
Whether a delivery may be sent, as a BreakerStore answers.
AttemptOutcome
How an attempt came out.
BreakerScope
What a circuit breaker is kept for.
DeliveryError
Why a delivery did not go through.
SettledOutcome
How a delivery settled.

Traits§

BreakerStore
Where circuit breakers are kept: in the deliverer’s memory unless the application gives it a store of its own, such as one in Redis that the deliverers of every process share, as Mastodon keeps its Stoplights.
SenderKeys
Where a sender’s signing key comes from: the application.

Functions§

deliver
Deliver body to inbox, signed with key, trying first and then the other scheme if first is refused. Returns the scheme that was accepted.
deliver_with_headers
deliver, with extra headers sent beside the signature’s, such as a Collection-Synchronization header (FEP-8fcf). They are not signed.
permanent_status
Whether an inbox answering status is answering what will not change: a 4xx, except 408 and 429, which say the request came at a bad time.

Type Aliases§

BreakerFuture
A future a BreakerStore answers with.