synapse.federation.units module

Defines the JSON structure of the protocol units used by the server to server protocol.

class synapse.federation.units.Edu(**kwargs)

Bases: synapse.util.jsonobject.JsonEncodedObject

An Edu represents a piece of data sent from one homeserver to another.

In comparison to Pdus, Edus are not persisted for a long time on disk, are not meaningful beyond a given pair of homeservers, and don’t have an internal ID or previous references graph.

internal_keys = ['origin', 'destination']
required_keys = ['edu_type']
valid_keys = ['origin', 'destination', 'edu_type', 'content']
class synapse.federation.units.Transaction(transaction_id=None, pdus=[], **kwargs)

Bases: synapse.util.jsonobject.JsonEncodedObject

A transaction is a list of Pdus and Edus to be sent to a remote home server with some extra metadata.

Example transaction:

{
    "origin": "foo",
    "prev_ids": ["abc", "def"],
    "pdus": [
        ...
    ],
}
static create_new(pdus, **kwargs)

Used to create a new transaction. Will auto fill out transaction_id and origin_server_ts keys.

internal_keys = ['transaction_id', 'destination']
required_keys = ['transaction_id', 'origin', 'destination', 'origin_server_ts', 'pdus']
valid_keys = ['transaction_id', 'origin', 'destination', 'origin_server_ts', 'previous_ids', 'pdus', 'edus']