aboutsummaryrefslogtreecommitdiff
path: root/roomserver
diff options
context:
space:
mode:
authorkegsay <kegan@matrix.org>2022-05-05 09:56:03 +0100
committerGitHub <noreply@github.com>2022-05-05 09:56:03 +0100
commitd86dcbef66dad344bc38c58762a9634ff126d5c7 (patch)
treea8c95692a64a6303e02911c9a2d6b00fec3c84c8 /roomserver
parent3c940c428d529476b6fa2cbf1ba28d53ec011584 (diff)
syncapi: define specific interfaces for internal HTTP communications (#2416)
* syncapi: use finer-grained interfaces when making the syncapi * Use specific interfaces for syncapi-roomserver interactions * Define query access token api for shared http auth code
Diffstat (limited to 'roomserver')
-rw-r--r--roomserver/api/api.go81
1 files changed, 42 insertions, 39 deletions
diff --git a/roomserver/api/api.go b/roomserver/api/api.go
index f0ca8a61..2e4ec3ff 100644
--- a/roomserver/api/api.go
+++ b/roomserver/api/api.go
@@ -12,6 +12,8 @@ import (
// RoomserverInputAPI is used to write events to the room server.
type RoomserverInternalAPI interface {
+ SyncRoomserverAPI
+
// needed to avoid chicken and egg scenario when setting up the
// interdependencies between the roomserver and other input APIs
SetFederationAPI(fsAPI fsAPI.FederationInternalAPI, keyRing *gomatrixserverlib.KeyRing)
@@ -78,34 +80,6 @@ type RoomserverInternalAPI interface {
res *QueryPublishedRoomsResponse,
) error
- // Query the latest events and state for a room from the room server.
- QueryLatestEventsAndState(
- ctx context.Context,
- request *QueryLatestEventsAndStateRequest,
- response *QueryLatestEventsAndStateResponse,
- ) error
-
- // Query the state after a list of events in a room from the room server.
- QueryStateAfterEvents(
- ctx context.Context,
- request *QueryStateAfterEventsRequest,
- response *QueryStateAfterEventsResponse,
- ) error
-
- // Query a list of events by event ID.
- QueryEventsByID(
- ctx context.Context,
- request *QueryEventsByIDRequest,
- response *QueryEventsByIDResponse,
- ) error
-
- // Query the membership event for an user for a room.
- QueryMembershipForUser(
- ctx context.Context,
- request *QueryMembershipForUserRequest,
- response *QueryMembershipForUserResponse,
- ) error
-
// Query a list of membership events for a room
QueryMembershipsForRoom(
ctx context.Context,
@@ -157,22 +131,11 @@ type RoomserverInternalAPI interface {
QueryCurrentState(ctx context.Context, req *QueryCurrentStateRequest, res *QueryCurrentStateResponse) error
// QueryRoomsForUser retrieves a list of room IDs matching the given query.
QueryRoomsForUser(ctx context.Context, req *QueryRoomsForUserRequest, res *QueryRoomsForUserResponse) error
- // QueryBulkStateContent does a bulk query for state event content in the given rooms.
- QueryBulkStateContent(ctx context.Context, req *QueryBulkStateContentRequest, res *QueryBulkStateContentResponse) error
- // QuerySharedUsers returns a list of users who share at least 1 room in common with the given user.
- QuerySharedUsers(ctx context.Context, req *QuerySharedUsersRequest, res *QuerySharedUsersResponse) error
// QueryKnownUsers returns a list of users that we know about from our joined rooms.
QueryKnownUsers(ctx context.Context, req *QueryKnownUsersRequest, res *QueryKnownUsersResponse) error
// QueryServerBannedFromRoom returns whether a server is banned from a room by server ACLs.
QueryServerBannedFromRoom(ctx context.Context, req *QueryServerBannedFromRoomRequest, res *QueryServerBannedFromRoomResponse) error
- // Query a given amount (or less) of events prior to a given set of events.
- PerformBackfill(
- ctx context.Context,
- request *PerformBackfillRequest,
- response *PerformBackfillResponse,
- ) error
-
// PerformForget forgets a rooms history for a specific user
PerformForget(ctx context.Context, req *PerformForgetRequest, resp *PerformForgetResponse) error
@@ -228,3 +191,43 @@ type RoomserverInternalAPI interface {
response *RemoveRoomAliasResponse,
) error
}
+
+// API functions required by the syncapi
+type SyncRoomserverAPI interface {
+ // Query the latest events and state for a room from the room server.
+ QueryLatestEventsAndState(
+ ctx context.Context,
+ request *QueryLatestEventsAndStateRequest,
+ response *QueryLatestEventsAndStateResponse,
+ ) error
+ // QueryBulkStateContent does a bulk query for state event content in the given rooms.
+ QueryBulkStateContent(ctx context.Context, req *QueryBulkStateContentRequest, res *QueryBulkStateContentResponse) error
+ // QuerySharedUsers returns a list of users who share at least 1 room in common with the given user.
+ QuerySharedUsers(ctx context.Context, req *QuerySharedUsersRequest, res *QuerySharedUsersResponse) error
+ // Query a list of events by event ID.
+ QueryEventsByID(
+ ctx context.Context,
+ request *QueryEventsByIDRequest,
+ response *QueryEventsByIDResponse,
+ ) error
+ // Query the membership event for an user for a room.
+ QueryMembershipForUser(
+ ctx context.Context,
+ request *QueryMembershipForUserRequest,
+ response *QueryMembershipForUserResponse,
+ ) error
+
+ // Query the state after a list of events in a room from the room server.
+ QueryStateAfterEvents(
+ ctx context.Context,
+ request *QueryStateAfterEventsRequest,
+ response *QueryStateAfterEventsResponse,
+ ) error
+
+ // Query a given amount (or less) of events prior to a given set of events.
+ PerformBackfill(
+ ctx context.Context,
+ request *PerformBackfillRequest,
+ response *PerformBackfillResponse,
+ ) error
+}