Clean up interface definitions (#2427)

* tidy up interfaces

* remove unused GetCreatorIDForAlias

* Add RoomserverUserAPI interface

* Define more interfaces

* Use AppServiceInternalAPI for consistent naming

* clean up federationapi constructor a bit

* Fix monolith in -http mode
This commit is contained in:
kegsay 2022-05-06 12:39:26 +01:00 committed by GitHub
parent 4705f5761e
commit 85704eff20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 236 additions and 429 deletions

View file

@ -50,8 +50,8 @@ func AddPublicRoutes(
federation *gomatrixserverlib.FederationClient,
keyRing gomatrixserverlib.JSONVerifier,
rsAPI roomserverAPI.FederationRoomserverAPI,
federationAPI federationAPI.FederationInternalAPI,
keyAPI keyserverAPI.KeyInternalAPI,
fedAPI federationAPI.FederationInternalAPI,
keyAPI keyserverAPI.FederationKeyAPI,
servers federationAPI.ServersInRoomProvider,
) {
cfg := &base.Cfg.FederationAPI
@ -67,12 +67,23 @@ func AddPublicRoutes(
UserAPI: userAPI,
}
// the federationapi component is a bit unique in that it attaches public routes AND serves
// internal APIs (because it used to be 2 components: the 2nd being fedsender). As a result,
// the constructor shape is a bit wonky in that it is not valid to AddPublicRoutes without a
// concrete impl of FederationInternalAPI as the public routes and the internal API _should_
// be the same thing now.
f, ok := fedAPI.(*internal.FederationInternalAPI)
if !ok {
panic("federationapi.AddPublicRoutes called with a FederationInternalAPI impl which was not " +
"FederationInternalAPI. This is a programming error.")
}
routing.Setup(
base.PublicFederationAPIMux,
base.PublicKeyAPIMux,
base.PublicWellKnownAPIMux,
cfg,
rsAPI, federationAPI, keyRing,
rsAPI, f, keyRing,
federation, userAPI, keyAPI, mscCfg,
servers, producer,
)