From fea8b5787a70f6afb235158030529ad23116632e Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Mon, 5 Dec 2022 13:14:58 -0700 Subject: [PATCH] Mark the possible separation line for mailservers --- federationapi/api/api.go | 17 ++++++++++++----- federationapi/routing/asyncevents.go | 1 + federationapi/routing/forwardasync.go | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/federationapi/api/api.go b/federationapi/api/api.go index 2b29751ac..85fb09875 100644 --- a/federationapi/api/api.go +++ b/federationapi/api/api.go @@ -18,6 +18,7 @@ type FederationInternalAPI interface { gomatrixserverlib.KeyDatabase ClientFederationAPI RoomserverFederationAPI + MailserverAPI QueryServerKeys(ctx context.Context, request *QueryServerKeysRequest, response *QueryServerKeysResponse) error LookupServerKeys(ctx context.Context, s gomatrixserverlib.ServerName, keyRequests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp) ([]gomatrixserverlib.ServerKeys, error) @@ -30,21 +31,27 @@ type FederationInternalAPI interface { request *PerformBroadcastEDURequest, response *PerformBroadcastEDUResponse, ) error + PerformWakeupServers( + ctx context.Context, + request *PerformWakeupServersRequest, + response *PerformWakeupServersResponse, + ) error +} + +type MailserverAPI interface { + // Store async transactions for forwarding to the destination at a later time. PerformStoreAsync( ctx context.Context, request *PerformStoreAsyncRequest, response *PerformStoreAsyncResponse, ) error + + // Obtain the oldest stored transaction for the specified userID. QueryAsyncTransactions( ctx context.Context, request *QueryAsyncTransactionsRequest, response *QueryAsyncTransactionsResponse, ) error - PerformWakeupServers( - ctx context.Context, - request *PerformWakeupServersRequest, - response *PerformWakeupServersResponse, - ) error } type ClientFederationAPI interface { diff --git a/federationapi/routing/asyncevents.go b/federationapi/routing/asyncevents.go index 9a35e6805..c8cbf1dd9 100644 --- a/federationapi/routing/asyncevents.go +++ b/federationapi/routing/asyncevents.go @@ -14,6 +14,7 @@ type AsyncEventsResponse struct { } // GetAsyncEvents implements /_matrix/federation/v1/async_events/{userID} +// This endpoint can be extracted into a separate mailserver service. func GetAsyncEvents( httpReq *http.Request, fedReq *gomatrixserverlib.FederationRequest, diff --git a/federationapi/routing/forwardasync.go b/federationapi/routing/forwardasync.go index f290c8313..9d7089ac4 100644 --- a/federationapi/routing/forwardasync.go +++ b/federationapi/routing/forwardasync.go @@ -11,6 +11,7 @@ import ( ) // ForwardAsync implements /_matrix/federation/v1/forward_async/{txnID}/{userID} +// This endpoint can be extracted into a separate mailserver service. func ForwardAsync( httpReq *http.Request, fedReq *gomatrixserverlib.FederationRequest,