mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-15 13:42:26 +03:00
Consolidation of roomserver APIs (#994)
* Consolidation of roomserver APIs * Comment out alias tests for now, they are broken * Wire AS API into roomserver again * Roomserver didn't take asAPI param before so return to that * Prevent roomserver asking AS API for alias info * Rename some files * Remove alias_test, incoherent tests and unwanted appservice integration * Remove FS API inject on syncapi component
This commit is contained in:
parent
ebbfc12592
commit
e15f6676ac
72 changed files with 894 additions and 1170 deletions
41
roomserver/api/http.go
Normal file
41
roomserver/api/http.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/matrix-org/dendrite/common/caching"
|
||||
fsInputAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||
)
|
||||
|
||||
type httpRoomserverInternalAPI struct {
|
||||
roomserverURL string
|
||||
httpClient *http.Client
|
||||
fsAPI fsInputAPI.FederationSenderInternalAPI
|
||||
immutableCache caching.ImmutableCache
|
||||
}
|
||||
|
||||
// NewRoomserverInputAPIHTTP creates a RoomserverInputAPI implemented by talking to a HTTP POST API.
|
||||
// If httpClient is nil an error is returned
|
||||
func NewRoomserverInternalAPIHTTP(
|
||||
roomserverURL string,
|
||||
httpClient *http.Client,
|
||||
//fsInputAPI fsAPI.FederationSenderInternalAPI,
|
||||
immutableCache caching.ImmutableCache,
|
||||
) (RoomserverInternalAPI, error) {
|
||||
if httpClient == nil {
|
||||
return nil, errors.New("NewRoomserverInternalAPIHTTP: httpClient is <nil>")
|
||||
}
|
||||
return &httpRoomserverInternalAPI{
|
||||
roomserverURL: roomserverURL,
|
||||
httpClient: httpClient,
|
||||
immutableCache: immutableCache,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SetFederationSenderInputAPI passes in a federation sender input API reference
|
||||
// so that we can avoid the chicken-and-egg problem of both the roomserver input API
|
||||
// and the federation sender input API being interdependent.
|
||||
func (h *httpRoomserverInternalAPI) SetFederationSenderAPI(fsAPI fsInputAPI.FederationSenderInternalAPI) {
|
||||
h.fsAPI = fsAPI
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue