Roomserver API changes (#1118)

* s/QueryBackfill/PerformBackfill/g

* OutputEvent now includes AddStateEvents which contain the full event of extra state events

* Only include adds not the current event

* Get adding state right
This commit is contained in:
Kegsay 2020-06-11 19:50:40 +01:00 committed by GitHub
parent 25cd2dd1c9
commit ec7718e7f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 152 additions and 287 deletions

View file

@ -441,11 +441,11 @@ func (r *RoomserverInternalAPI) QueryMissingEvents(
return err
}
// QueryBackfill implements api.RoomServerQueryAPI
func (r *RoomserverInternalAPI) QueryBackfill(
// PerformBackfill implements api.RoomServerQueryAPI
func (r *RoomserverInternalAPI) PerformBackfill(
ctx context.Context,
request *api.QueryBackfillRequest,
response *api.QueryBackfillResponse,
request *api.PerformBackfillRequest,
response *api.PerformBackfillResponse,
) error {
// if we are requesting the backfill then we need to do a federation hit
// TODO: we could be more sensible and fetch as many events we already have then request the rest
@ -489,7 +489,7 @@ func (r *RoomserverInternalAPI) QueryBackfill(
return err
}
func (r *RoomserverInternalAPI) backfillViaFederation(ctx context.Context, req *api.QueryBackfillRequest, res *api.QueryBackfillResponse) error {
func (r *RoomserverInternalAPI) backfillViaFederation(ctx context.Context, req *api.PerformBackfillRequest, res *api.PerformBackfillResponse) error {
roomVer, err := r.DB.GetRoomVersionForRoom(ctx, req.RoomID)
if err != nil {
return fmt.Errorf("backfillViaFederation: unknown room version for room %s : %w", req.RoomID, err)
@ -647,7 +647,7 @@ func (r *RoomserverInternalAPI) scanEventTree(
var pre string
// TODO: add tests for this function to ensure it meets the contract that callers expect (and doc what that is supposed to be)
// Currently, callers like QueryBackfill will call scanEventTree with a pre-populated `visited` map, assuming that by doing
// Currently, callers like PerformBackfill will call scanEventTree with a pre-populated `visited` map, assuming that by doing
// so means that the events in that map will NOT be returned from this function. That is not currently true, resulting in
// duplicate events being sent in response to /backfill requests.
initialIgnoreList := make(map[string]bool, len(visited))