fep

FEP-49eb: Batched Inbox Delivery

Summary

This document describes a method of delivering multiple activities to an inbox within a single POST request. It may be combined with FEP-0499 Multibox with minimal changes, but adherence to FEP-0499 is not required for this FEP.

Prior Art

This section is non-normative

Requirements

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this specification are to be interpreted as described in [RFC-2119].

Batches

A ‘batch’ is a Collection or OrderedCollection of activities. It MUST include the following properties:

A batch SHOULD include the following properties:

The batch MAY include any additional properties.

Batches MUST NOT contain more than 50 activities.

When signing activities using FEP-8b32: Object Integrity Proofs, the activities within the batch MUST be signed individually. This is to allow the receiving server to forward/process the received activities with greater flexibility.

Delivery

To deliver a batch to an inbox, POST a DeliverBatch activity to the inbox with the batch collection embedded in the object property.

{
	"type": "DeliverBatch",
	"id": "https://example.com/batch/1",
	"actor": "https://example.com/actor",
	"object": {
		"items": [
			// ... activities
		],
		"totalItems": 50,
		"startTime": "1970-01-01T00:00:00",
		"endTime": "1970-01-01T00:01:00"
	},
}

The actor of this DeliverBatch activity SHOULD be the Application Actor if there is more than one actor of the batch’s activities. Otherwise, if all the batched activities share the same actor, the DeliverBatch’s actor MAY be the same.

When delivering activities via FEP-0499: Multibox, the target property is added as described in FEP-0499.

When delivered to an actor’s inbox, all activities within the batch MUST be addressed to at least that actor. When delivered to a sharedInbox, the activities can be freely addressed to any actor.

Processing

Activities within a batch of type OrderedCollection MUST be processed in the order they were defined. Conversely, activities within a batch of type Collection MAY be processed in any order.

Batched activities are processed and addressed as if they were sent individually. Receiving a Create<Note> individually and receiving a batch containing Create<Note> MUST have the same effect.

Servers MUST NOT add the DeliverBatch activity to inboxes.

Capability Discovery

As batched inbox support may be present on any inbox, there is no way to tell if an inbox supports it without first attempting it and falling back on failure. However, doing so may be unreliable as servers may only do light processing of the DeliverBatch activity and/or signatures before adding it to a queue and failing later.

To solve this, FEP-844e: Capability Discovery MAY be used to determine if a server supports batched inboxes.

When doing so, the value of the href property MUST be http://w3id.org/fep/49eb and the value of the name property MUST be FEP-49eb: Batched Inbox Delivery. Additionally, the server MUST support batched inbox delivery for all inboxes it controls.

Batched Inboxes

Alternatively to using FEP-844e to signal batched support globally, a server MAY include a batchedInbox property on actors that accept DeliverBatch activities.

{
	"type": "Person",
	"id": "https://example.com/me",
	// ...
	"inbox": "https://example.com/me/inbox",
	"batchedInbox": "https://example.com/me/inbox",
}

As shown in the above example, the batchedInbox MAY be the same as the actor’s regular inbox.

References

CC0 1.0 Universal (CC0 1.0) Public Domain Dedication

To the extent possible under law, the authors of this Fediverse Enhancement Proposal have waived all copyright and related or neighboring rights to this work.