mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
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:
parent
4705f5761e
commit
85704eff20
37 changed files with 236 additions and 429 deletions
|
@ -41,9 +41,6 @@ type RoomserverInternalAPIDatabase interface {
|
|||
// Look up all aliases referring to a given room ID.
|
||||
// Returns an error if there was a problem talking to the database.
|
||||
GetAliasesForRoomID(ctx context.Context, roomID string) ([]string, error)
|
||||
// Get the user ID of the creator of an alias.
|
||||
// Returns an error if there was a problem talking to the database.
|
||||
GetCreatorIDForAlias(ctx context.Context, alias string) (string, error)
|
||||
// Remove a given room alias.
|
||||
// Returns an error if there was a problem talking to the database.
|
||||
RemoveRoomAlias(ctx context.Context, alias string) error
|
||||
|
@ -134,22 +131,6 @@ func (r *RoomserverInternalAPI) GetAliasesForRoomID(
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetCreatorIDForAlias implements alias.RoomserverInternalAPI
|
||||
func (r *RoomserverInternalAPI) GetCreatorIDForAlias(
|
||||
ctx context.Context,
|
||||
request *api.GetCreatorIDForAliasRequest,
|
||||
response *api.GetCreatorIDForAliasResponse,
|
||||
) error {
|
||||
// Look up the aliases in the database for the given RoomID
|
||||
creatorID, err := r.DB.GetCreatorIDForAlias(ctx, request.Alias)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
response.UserID = creatorID
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveRoomAlias implements alias.RoomserverInternalAPI
|
||||
func (r *RoomserverInternalAPI) RemoveRoomAlias(
|
||||
ctx context.Context,
|
||||
|
|
|
@ -44,7 +44,7 @@ type RoomserverInternalAPI struct {
|
|||
KeyRing gomatrixserverlib.JSONVerifier
|
||||
ServerACLs *acls.ServerACLs
|
||||
fsAPI fsAPI.RoomserverFederationAPI
|
||||
asAPI asAPI.AppServiceQueryAPI
|
||||
asAPI asAPI.AppServiceInternalAPI
|
||||
NATSClient *nats.Conn
|
||||
JetStream nats.JetStreamContext
|
||||
Durable string
|
||||
|
@ -177,11 +177,11 @@ func (r *RoomserverInternalAPI) SetFederationAPI(fsAPI fsAPI.RoomserverFederatio
|
|||
}
|
||||
}
|
||||
|
||||
func (r *RoomserverInternalAPI) SetUserAPI(userAPI userapi.UserInternalAPI) {
|
||||
func (r *RoomserverInternalAPI) SetUserAPI(userAPI userapi.RoomserverUserAPI) {
|
||||
r.Leaver.UserAPI = userAPI
|
||||
}
|
||||
|
||||
func (r *RoomserverInternalAPI) SetAppserviceAPI(asAPI asAPI.AppServiceQueryAPI) {
|
||||
func (r *RoomserverInternalAPI) SetAppserviceAPI(asAPI asAPI.AppServiceInternalAPI) {
|
||||
r.asAPI = asAPI
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ type Leaver struct {
|
|||
Cfg *config.RoomServer
|
||||
DB storage.Database
|
||||
FSAPI fsAPI.RoomserverFederationAPI
|
||||
UserAPI userapi.UserInternalAPI
|
||||
UserAPI userapi.RoomserverUserAPI
|
||||
Inputer *input.Inputer
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue