diff --git a/roomserver/api/api_trace.go b/roomserver/api/api_trace.go index 1a2b9a49..c18279f0 100644 --- a/roomserver/api/api_trace.go +++ b/roomserver/api/api_trace.go @@ -208,6 +208,16 @@ func (t *RoomserverInternalAPITrace) QueryStateAndAuthChain( return err } +func (t *RoomserverInternalAPITrace) QueryStateAndAuthChainIDs( + ctx context.Context, + req *QueryStateAndAuthChainIDsRequest, + res *QueryStateAndAuthChainIDsResponse, +) error { + err := t.Impl.QueryStateAndAuthChainIDs(ctx, req, res) + util.GetLogger(ctx).WithError(err).Infof("QueryStateAndAuthChainIDs req=%+v res=%+v", js(req), js(res)) + return err +} + func (t *RoomserverInternalAPITrace) PerformBackfill( ctx context.Context, req *PerformBackfillRequest, diff --git a/roomserver/inthttp/client.go b/roomserver/inthttp/client.go index 6774d102..0ba0031d 100644 --- a/roomserver/inthttp/client.go +++ b/roomserver/inthttp/client.go @@ -47,6 +47,7 @@ const ( RoomserverQueryServerAllowedToSeeEventPath = "/roomserver/queryServerAllowedToSeeEvent" RoomserverQueryMissingEventsPath = "/roomserver/queryMissingEvents" RoomserverQueryStateAndAuthChainPath = "/roomserver/queryStateAndAuthChain" + RoomserverQueryStateAndAuthChainIDsPath = "/roomserver/queryStateAndAuthChainIDs" RoomserverQueryRoomVersionCapabilitiesPath = "/roomserver/queryRoomVersionCapabilities" RoomserverQueryRoomVersionForRoomPath = "/roomserver/queryRoomVersionForRoom" RoomserverQueryPublishedRoomsPath = "/roomserver/queryPublishedRooms" @@ -417,6 +418,19 @@ func (h *httpRoomserverInternalAPI) QueryStateAndAuthChain( return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response) } +// QueryStateAndAuthChainIDs implements RoomserverQueryAPI +func (h *httpRoomserverInternalAPI) QueryStateAndAuthChainIDs( + ctx context.Context, + request *api.QueryStateAndAuthChainIDsRequest, + response *api.QueryStateAndAuthChainIDsResponse, +) error { + span, ctx := opentracing.StartSpanFromContext(ctx, "QueryStateAndAuthChainIDs") + defer span.Finish() + + apiURL := h.roomserverURL + RoomserverQueryStateAndAuthChainIDsPath + return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response) +} + // PerformBackfill implements RoomServerQueryAPI func (h *httpRoomserverInternalAPI) PerformBackfill( ctx context.Context, diff --git a/roomserver/inthttp/server.go b/roomserver/inthttp/server.go index bf319262..3d7fe4b1 100644 --- a/roomserver/inthttp/server.go +++ b/roomserver/inthttp/server.go @@ -261,6 +261,20 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) { return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) + internalAPIMux.Handle( + RoomserverQueryStateAndAuthChainIDsPath, + httputil.MakeInternalAPI("queryStateAndAuthChainIDs", func(req *http.Request) util.JSONResponse { + var request api.QueryStateAndAuthChainIDsRequest + var response api.QueryStateAndAuthChainIDsResponse + if err := json.NewDecoder(req.Body).Decode(&request); err != nil { + return util.ErrorResponse(err) + } + if err := r.QueryStateAndAuthChainIDs(req.Context(), &request, &response); err != nil { + return util.ErrorResponse(err) + } + return util.JSONResponse{Code: http.StatusOK, JSON: &response} + }), + ) internalAPIMux.Handle( RoomserverPerformBackfillPath, httputil.MakeInternalAPI("PerformBackfill", func(req *http.Request) util.JSONResponse {