mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-04 02:34:09 +01:00
Improve documentation for backfilling rooms
There's not a whole lot to improve here - most of the changes are about reorganization and minor clarifications.
This commit is contained in:
parent
1d019c3757
commit
5aef545128
77
api/server-server/backfill.yaml
Normal file
77
api/server-server/backfill.yaml
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
# Copyright 2018 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
title: "Matrix Federation Events API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8448
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
basePath: /_matrix/federation/v1
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
paths:
|
||||||
|
"/backfill/{roomId}":
|
||||||
|
get:
|
||||||
|
summary: Retrieves the events which precede the given event
|
||||||
|
description: |-
|
||||||
|
Retreives a sliding-window history of previous PDUs that occurred in the given room.
|
||||||
|
Starting from the PDU ID(s) given in the ``v`` argument, the PDUs that preceded it
|
||||||
|
are retrieved, up to the total number given by the ``limit``.
|
||||||
|
operationId: backfillRoom
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: roomId
|
||||||
|
type: string
|
||||||
|
description: The room ID to backfill.
|
||||||
|
required: true
|
||||||
|
x-example: "!SomeRoom:matrix.org"
|
||||||
|
- in: query
|
||||||
|
name: v
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description: The event IDs to backfill from.
|
||||||
|
required: true
|
||||||
|
x-example: ["$abc123:matrix.org"]
|
||||||
|
- in: query
|
||||||
|
name: limit
|
||||||
|
type: integer
|
||||||
|
description: The maximum number of PDUs to retrieve, including the given events.
|
||||||
|
required: true
|
||||||
|
x-example: 2
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
A transaction containing the PDUs that preceded the given event(s), including the given
|
||||||
|
event(s), up to the given limit.
|
||||||
|
schema:
|
||||||
|
$ref: "definitions/transaction.yaml"
|
||||||
|
# Override the example to show the response of the request a bit better
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"$ref": "examples/transaction.json",
|
||||||
|
"pdus": [
|
||||||
|
{
|
||||||
|
"$ref": "pdu.json",
|
||||||
|
"room_id": "!SomeRoom:matrix.org",
|
||||||
|
"event_id": "$abc123:matrix.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "pdu.json",
|
||||||
|
"room_id": "!SomeRoom:matrix.org"
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -59,35 +59,3 @@ paths:
|
||||||
description: A transaction containing a single PDU which is the event requested.
|
description: A transaction containing a single PDU which is the event requested.
|
||||||
schema:
|
schema:
|
||||||
$ref: "definitions/transaction.yaml"
|
$ref: "definitions/transaction.yaml"
|
||||||
"/backfill/{roomId}":
|
|
||||||
get:
|
|
||||||
summary: Retrieves the events which precede the given event
|
|
||||||
description: |-
|
|
||||||
Retreives a sliding-window history of previous PDUs that occurred in the given room.
|
|
||||||
Starting from the PDU ID(s) given in the ``v`` argument, the PDUs that preceded it
|
|
||||||
are retrieved, up to the total number given by the ``limit``.
|
|
||||||
operationId: backfillRoom
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: roomId
|
|
||||||
type: string
|
|
||||||
description: The room ID to backfill.
|
|
||||||
required: true
|
|
||||||
x-example: "!abc123:matrix.org"
|
|
||||||
- in: query
|
|
||||||
name: v
|
|
||||||
type: string # TODO: The description says this is plural - figure out how to specify multiple, and spec it
|
|
||||||
description: The event ID to backfill from.
|
|
||||||
required: true
|
|
||||||
x-example: "$abc123:matrix.org"
|
|
||||||
- in: query
|
|
||||||
name: limit
|
|
||||||
type: integer
|
|
||||||
description: The maximum number of events to retrieve.
|
|
||||||
required: true
|
|
||||||
x-example: 10
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: A transaction containing the PDUs that preceded the given event(s).
|
|
||||||
schema:
|
|
||||||
$ref: "definitions/transaction.yaml"
|
|
||||||
|
|
|
||||||
|
|
@ -850,32 +850,17 @@ To cover this case, the federation API provides a server-to-server analog of
|
||||||
the ``/messages`` client API, allowing one homeserver to fetch history from
|
the ``/messages`` client API, allowing one homeserver to fetch history from
|
||||||
another. This is the ``/backfill`` API.
|
another. This is the ``/backfill`` API.
|
||||||
|
|
||||||
To request more history, the requesting homeserver picks another homeserver
|
To request more history, the requesting homeserver picks another homeserver
|
||||||
that it thinks may have more (most likely this should be a homeserver for some
|
that it thinks may have more (most likely this should be a homeserver for
|
||||||
of the existing users in the room at the earliest point in history it has
|
some of the existing users in the room at the earliest point in history it
|
||||||
currently), and makes a ``/backfill`` request. The parameters of this request
|
has currently), and makes a ``/backfill`` request.
|
||||||
give an event ID that the requesting homeserver wishes to obtain, and a number
|
|
||||||
specifying how many more events of history before that one to return at most.
|
|
||||||
|
|
||||||
The response to this request is an object with the following keys:
|
|
||||||
|
|
||||||
======================== ============ =========================================
|
|
||||||
Key Type Description
|
|
||||||
======================== ============ =========================================
|
|
||||||
``pdus`` List A list of events.
|
|
||||||
``origin`` String The name of the resident homeserver.
|
|
||||||
``origin_server_ts`` Integer A timestamp added by the resident
|
|
||||||
homeserver.
|
|
||||||
======================== ============ =========================================
|
|
||||||
|
|
||||||
The list of events given in ``pdus`` is returned in reverse chronological
|
|
||||||
order; having the most recent event first (i.e. the event whose event ID is
|
|
||||||
that requested by the requester in the ``v`` parameter).
|
|
||||||
|
|
||||||
.. TODO-spec
|
.. TODO-spec
|
||||||
Specify (or remark that it is unspecified) how the server handles divergent
|
Specify (or remark that it is unspecified) how the server handles divergent
|
||||||
history. DFS? BFS? Anything weirder?
|
history. DFS? BFS? Anything weirder?
|
||||||
|
|
||||||
|
{{backfill_ss_http_api}}
|
||||||
|
|
||||||
Inviting to a room
|
Inviting to a room
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue