mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 19:51:39 +00:00
Federation sender API remodel (#988)
* Define an input API for the federationsender * Wiring for rooomserver input API and federation sender input API * Whoops, commit common too * Merge input API into query API * Rename FederationSenderQueryAPI to FederationSenderInternalAPI * Fix dendritejs * Rename Input to Perform * Fix a couple of inputs -> performs * Remove needless storage interface, add comments
This commit is contained in:
parent
a4b9edb28e
commit
a308e61331
@ -44,7 +44,7 @@ func SetupClientAPIComponent(
|
|||||||
eduInputAPI eduServerAPI.EDUServerInputAPI,
|
eduInputAPI eduServerAPI.EDUServerInputAPI,
|
||||||
asAPI appserviceAPI.AppServiceQueryAPI,
|
asAPI appserviceAPI.AppServiceQueryAPI,
|
||||||
transactionsCache *transactions.Cache,
|
transactionsCache *transactions.Cache,
|
||||||
fedSenderAPI federationSenderAPI.FederationSenderQueryAPI,
|
fsAPI federationSenderAPI.FederationSenderInternalAPI,
|
||||||
) {
|
) {
|
||||||
roomserverProducer := producers.NewRoomserverProducer(inputAPI, queryAPI)
|
roomserverProducer := producers.NewRoomserverProducer(inputAPI, queryAPI)
|
||||||
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
|
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
|
||||||
@ -69,6 +69,6 @@ func SetupClientAPIComponent(
|
|||||||
routing.Setup(
|
routing.Setup(
|
||||||
base.APIMux, base.Cfg, roomserverProducer, queryAPI, aliasAPI, asAPI,
|
base.APIMux, base.Cfg, roomserverProducer, queryAPI, aliasAPI, asAPI,
|
||||||
accountsDB, deviceDB, federation, *keyRing, userUpdateProducer,
|
accountsDB, deviceDB, federation, *keyRing, userUpdateProducer,
|
||||||
syncProducer, eduProducer, transactionsCache, fedSenderAPI,
|
syncProducer, eduProducer, transactionsCache, fsAPI,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func DirectoryRoom(
|
|||||||
federation *gomatrixserverlib.FederationClient,
|
federation *gomatrixserverlib.FederationClient,
|
||||||
cfg *config.Dendrite,
|
cfg *config.Dendrite,
|
||||||
rsAPI roomserverAPI.RoomserverAliasAPI,
|
rsAPI roomserverAPI.RoomserverAliasAPI,
|
||||||
fedSenderAPI federationSenderAPI.FederationSenderQueryAPI,
|
fedSenderAPI federationSenderAPI.FederationSenderInternalAPI,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
_, domain, err := gomatrixserverlib.SplitID('#', roomAlias)
|
_, domain, err := gomatrixserverlib.SplitID('#', roomAlias)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -60,7 +60,7 @@ func Setup(
|
|||||||
syncProducer *producers.SyncAPIProducer,
|
syncProducer *producers.SyncAPIProducer,
|
||||||
eduProducer *producers.EDUServerProducer,
|
eduProducer *producers.EDUServerProducer,
|
||||||
transactionsCache *transactions.Cache,
|
transactionsCache *transactions.Cache,
|
||||||
federationSender federationSenderAPI.FederationSenderQueryAPI,
|
federationSender federationSenderAPI.FederationSenderInternalAPI,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
apiMux.Handle("/_matrix/client/versions",
|
apiMux.Handle("/_matrix/client/versions",
|
||||||
|
@ -37,12 +37,12 @@ func main() {
|
|||||||
|
|
||||||
asQuery := base.CreateHTTPAppServiceAPIs()
|
asQuery := base.CreateHTTPAppServiceAPIs()
|
||||||
alias, input, query := base.CreateHTTPRoomserverAPIs()
|
alias, input, query := base.CreateHTTPRoomserverAPIs()
|
||||||
fedSenderAPI := base.CreateHTTPFederationSenderAPIs()
|
fsAPI := base.CreateHTTPFederationSenderAPIs()
|
||||||
eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New())
|
eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New())
|
||||||
|
|
||||||
clientapi.SetupClientAPIComponent(
|
clientapi.SetupClientAPIComponent(
|
||||||
base, deviceDB, accountDB, federation, &keyRing,
|
base, deviceDB, accountDB, federation, &keyRing,
|
||||||
alias, input, query, eduInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
alias, input, query, eduInputAPI, asQuery, transactions.New(), fsAPI,
|
||||||
)
|
)
|
||||||
|
|
||||||
base.SetupAndServeHTTP(string(base.Cfg.Bind.ClientAPI), string(base.Cfg.Listen.ClientAPI))
|
base.SetupAndServeHTTP(string(base.Cfg.Bind.ClientAPI), string(base.Cfg.Listen.ClientAPI))
|
||||||
|
@ -153,15 +153,15 @@ func main() {
|
|||||||
asQuery := appservice.SetupAppServiceAPIComponent(
|
asQuery := appservice.SetupAppServiceAPIComponent(
|
||||||
&base.Base, accountDB, deviceDB, federation, alias, query, transactions.New(),
|
&base.Base, accountDB, deviceDB, federation, alias, query, transactions.New(),
|
||||||
)
|
)
|
||||||
fedSenderAPI := federationsender.SetupFederationSenderComponent(&base.Base, federation, query, input)
|
fsAPI := federationsender.SetupFederationSenderComponent(&base.Base, federation, query, input)
|
||||||
|
|
||||||
clientapi.SetupClientAPIComponent(
|
clientapi.SetupClientAPIComponent(
|
||||||
&base.Base, deviceDB, accountDB,
|
&base.Base, deviceDB, accountDB,
|
||||||
federation, &keyRing, alias, input, query,
|
federation, &keyRing, alias, input, query,
|
||||||
eduInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
eduInputAPI, asQuery, transactions.New(), fsAPI,
|
||||||
)
|
)
|
||||||
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
|
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
|
||||||
federationapi.SetupFederationAPIComponent(&base.Base, accountDB, deviceDB, federation, &keyRing, alias, input, query, asQuery, fedSenderAPI, eduProducer)
|
federationapi.SetupFederationAPIComponent(&base.Base, accountDB, deviceDB, federation, &keyRing, alias, input, query, asQuery, fsAPI, eduProducer)
|
||||||
mediaapi.SetupMediaAPIComponent(&base.Base, deviceDB)
|
mediaapi.SetupMediaAPIComponent(&base.Base, deviceDB)
|
||||||
publicRoomsDB, err := storage.NewPublicRoomsServerDatabaseWithPubSub(string(base.Base.Cfg.Database.PublicRoomsAPI), base.LibP2PPubsub)
|
publicRoomsDB, err := storage.NewPublicRoomsServerDatabaseWithPubSub(string(base.Base.Cfg.Database.PublicRoomsAPI), base.LibP2PPubsub)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -32,7 +32,7 @@ func main() {
|
|||||||
deviceDB := base.CreateDeviceDB()
|
deviceDB := base.CreateDeviceDB()
|
||||||
keyDB := base.CreateKeyDB()
|
keyDB := base.CreateKeyDB()
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
federationSender := base.CreateHTTPFederationSenderAPIs()
|
fsAPI := base.CreateHTTPFederationSenderAPIs()
|
||||||
keyRing := keydb.CreateKeyRing(federation.Client, keyDB, cfg.Matrix.KeyPerspectives)
|
keyRing := keydb.CreateKeyRing(federation.Client, keyDB, cfg.Matrix.KeyPerspectives)
|
||||||
|
|
||||||
alias, input, query := base.CreateHTTPRoomserverAPIs()
|
alias, input, query := base.CreateHTTPRoomserverAPIs()
|
||||||
@ -42,7 +42,7 @@ func main() {
|
|||||||
|
|
||||||
federationapi.SetupFederationAPIComponent(
|
federationapi.SetupFederationAPIComponent(
|
||||||
base, accountDB, deviceDB, federation, &keyRing,
|
base, accountDB, deviceDB, federation, &keyRing,
|
||||||
alias, input, query, asQuery, federationSender, eduProducer,
|
alias, input, query, asQuery, fsAPI, eduProducer,
|
||||||
)
|
)
|
||||||
|
|
||||||
base.SetupAndServeHTTP(string(base.Cfg.Bind.FederationAPI), string(base.Cfg.Listen.FederationAPI))
|
base.SetupAndServeHTTP(string(base.Cfg.Bind.FederationAPI), string(base.Cfg.Listen.FederationAPI))
|
||||||
|
@ -62,15 +62,16 @@ func main() {
|
|||||||
asQuery := appservice.SetupAppServiceAPIComponent(
|
asQuery := appservice.SetupAppServiceAPIComponent(
|
||||||
base, accountDB, deviceDB, federation, alias, query, transactions.New(),
|
base, accountDB, deviceDB, federation, alias, query, transactions.New(),
|
||||||
)
|
)
|
||||||
fedSenderAPI := federationsender.SetupFederationSenderComponent(base, federation, query, input)
|
fsAPI := federationsender.SetupFederationSenderComponent(base, federation, query, input)
|
||||||
|
input.SetFederationSenderAPI(fsAPI)
|
||||||
|
|
||||||
clientapi.SetupClientAPIComponent(
|
clientapi.SetupClientAPIComponent(
|
||||||
base, deviceDB, accountDB,
|
base, deviceDB, accountDB,
|
||||||
federation, &keyRing, alias, input, query,
|
federation, &keyRing, alias, input, query,
|
||||||
eduInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
eduInputAPI, asQuery, transactions.New(), fsAPI,
|
||||||
)
|
)
|
||||||
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
|
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
|
||||||
federationapi.SetupFederationAPIComponent(base, accountDB, deviceDB, federation, &keyRing, alias, input, query, asQuery, fedSenderAPI, eduProducer)
|
federationapi.SetupFederationAPIComponent(base, accountDB, deviceDB, federation, &keyRing, alias, input, query, asQuery, fsAPI, eduProducer)
|
||||||
mediaapi.SetupMediaAPIComponent(base, deviceDB)
|
mediaapi.SetupMediaAPIComponent(base, deviceDB)
|
||||||
publicRoomsDB, err := storage.NewPublicRoomsServerDatabase(string(base.Cfg.Database.PublicRoomsAPI))
|
publicRoomsDB, err := storage.NewPublicRoomsServerDatabase(string(base.Cfg.Database.PublicRoomsAPI))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -30,7 +30,9 @@ func main() {
|
|||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
keyRing := keydb.CreateKeyRing(federation.Client, keyDB, cfg.Matrix.KeyPerspectives)
|
keyRing := keydb.CreateKeyRing(federation.Client, keyDB, cfg.Matrix.KeyPerspectives)
|
||||||
|
|
||||||
roomserver.SetupRoomServerComponent(base, keyRing, federation)
|
fsAPI := base.CreateHTTPFederationSenderAPIs()
|
||||||
|
_, input, _ := roomserver.SetupRoomServerComponent(base, keyRing, federation)
|
||||||
|
input.SetFederationSenderAPI(fsAPI)
|
||||||
|
|
||||||
base.SetupAndServeHTTP(string(base.Cfg.Bind.RoomServer), string(base.Cfg.Listen.RoomServer))
|
base.SetupAndServeHTTP(string(base.Cfg.Bind.RoomServer), string(base.Cfg.Listen.RoomServer))
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@ func main() {
|
|||||||
base, accountDB, deviceDB, federation, alias, query, transactions.New(),
|
base, accountDB, deviceDB, federation, alias, query, transactions.New(),
|
||||||
)
|
)
|
||||||
fedSenderAPI := federationsender.SetupFederationSenderComponent(base, federation, query, input)
|
fedSenderAPI := federationsender.SetupFederationSenderComponent(base, federation, query, input)
|
||||||
|
input.SetFederationSenderAPI(fedSenderAPI)
|
||||||
|
|
||||||
clientapi.SetupClientAPIComponent(
|
clientapi.SetupClientAPIComponent(
|
||||||
base, deviceDB, accountDB,
|
base, deviceDB, accountDB,
|
||||||
|
@ -149,12 +149,12 @@ func (b *BaseDendrite) CreateHTTPEDUServerAPIs() eduServerAPI.EDUServerInputAPI
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateHTTPFederationSenderAPIs returns FederationSenderQueryAPI for hitting
|
// CreateHTTPFederationSenderAPIs returns FederationSenderInternalAPI for hitting
|
||||||
// the federation sender over HTTP
|
// the federation sender over HTTP
|
||||||
func (b *BaseDendrite) CreateHTTPFederationSenderAPIs() federationSenderAPI.FederationSenderQueryAPI {
|
func (b *BaseDendrite) CreateHTTPFederationSenderAPIs() federationSenderAPI.FederationSenderInternalAPI {
|
||||||
f, err := federationSenderAPI.NewFederationSenderQueryAPIHTTP(b.Cfg.FederationSenderURL(), b.httpClient)
|
f, err := federationSenderAPI.NewFederationSenderInternalAPIHTTP(b.Cfg.FederationSenderURL(), b.httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Panic("NewFederationSenderQueryAPIHTTP failed", b.httpClient)
|
logrus.WithError(err).Panic("NewFederationSenderInternalAPIHTTP failed", b.httpClient)
|
||||||
}
|
}
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ func SetupFederationAPIComponent(
|
|||||||
inputAPI roomserverAPI.RoomserverInputAPI,
|
inputAPI roomserverAPI.RoomserverInputAPI,
|
||||||
queryAPI roomserverAPI.RoomserverQueryAPI,
|
queryAPI roomserverAPI.RoomserverQueryAPI,
|
||||||
asAPI appserviceAPI.AppServiceQueryAPI,
|
asAPI appserviceAPI.AppServiceQueryAPI,
|
||||||
federationSenderAPI federationSenderAPI.FederationSenderQueryAPI,
|
federationSenderAPI federationSenderAPI.FederationSenderInternalAPI,
|
||||||
eduProducer *producers.EDUServerProducer,
|
eduProducer *producers.EDUServerProducer,
|
||||||
) {
|
) {
|
||||||
roomserverProducer := producers.NewRoomserverProducer(inputAPI, queryAPI)
|
roomserverProducer := producers.NewRoomserverProducer(inputAPI, queryAPI)
|
||||||
|
@ -33,7 +33,7 @@ func RoomAliasToID(
|
|||||||
federation *gomatrixserverlib.FederationClient,
|
federation *gomatrixserverlib.FederationClient,
|
||||||
cfg *config.Dendrite,
|
cfg *config.Dendrite,
|
||||||
aliasAPI roomserverAPI.RoomserverAliasAPI,
|
aliasAPI roomserverAPI.RoomserverAliasAPI,
|
||||||
senderAPI federationSenderAPI.FederationSenderQueryAPI,
|
senderAPI federationSenderAPI.FederationSenderInternalAPI,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
roomAlias := httpReq.FormValue("room_alias")
|
roomAlias := httpReq.FormValue("room_alias")
|
||||||
if roomAlias == "" {
|
if roomAlias == "" {
|
||||||
|
@ -49,7 +49,7 @@ func Setup(
|
|||||||
asAPI appserviceAPI.AppServiceQueryAPI,
|
asAPI appserviceAPI.AppServiceQueryAPI,
|
||||||
producer *producers.RoomserverProducer,
|
producer *producers.RoomserverProducer,
|
||||||
eduProducer *producers.EDUServerProducer,
|
eduProducer *producers.EDUServerProducer,
|
||||||
federationSenderAPI federationSenderAPI.FederationSenderQueryAPI,
|
federationSenderAPI federationSenderAPI.FederationSenderInternalAPI,
|
||||||
keys gomatrixserverlib.KeyRing,
|
keys gomatrixserverlib.KeyRing,
|
||||||
federation *gomatrixserverlib.FederationClient,
|
federation *gomatrixserverlib.FederationClient,
|
||||||
accountDB accounts.Database,
|
accountDB accounts.Database,
|
||||||
|
53
federationsender/api/api.go
Normal file
53
federationsender/api/api.go
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FederationSenderInternalAPI is used to query information from the federation sender.
|
||||||
|
type FederationSenderInternalAPI interface {
|
||||||
|
// Query the joined hosts and the membership events accounting for their participation in a room.
|
||||||
|
// Note that if a server has multiple users in the room, it will have multiple entries in the returned slice.
|
||||||
|
// See `QueryJoinedHostServerNamesInRoom` for a de-duplicated version.
|
||||||
|
QueryJoinedHostsInRoom(
|
||||||
|
ctx context.Context,
|
||||||
|
request *QueryJoinedHostsInRoomRequest,
|
||||||
|
response *QueryJoinedHostsInRoomResponse,
|
||||||
|
) error
|
||||||
|
// Query the server names of the joined hosts in a room.
|
||||||
|
// Unlike QueryJoinedHostsInRoom, this function returns a de-duplicated slice
|
||||||
|
// containing only the server names (without information for membership events).
|
||||||
|
QueryJoinedHostServerNamesInRoom(
|
||||||
|
ctx context.Context,
|
||||||
|
request *QueryJoinedHostServerNamesInRoomRequest,
|
||||||
|
response *QueryJoinedHostServerNamesInRoomResponse,
|
||||||
|
) error
|
||||||
|
// Handle an instruction to make_join & send_join with a remote server.
|
||||||
|
PerformJoinRequest(
|
||||||
|
ctx context.Context,
|
||||||
|
request *PerformJoinRequest,
|
||||||
|
response *PerformJoinResponse,
|
||||||
|
) error
|
||||||
|
// Handle an instruction to make_leave & send_leave with a remote server.
|
||||||
|
PerformLeaveRequest(
|
||||||
|
ctx context.Context,
|
||||||
|
request *PerformLeaveRequest,
|
||||||
|
response *PerformLeaveResponse,
|
||||||
|
) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFederationSenderInternalAPIHTTP creates a FederationSenderInternalAPI implemented by talking to a HTTP POST API.
|
||||||
|
// If httpClient is nil an error is returned
|
||||||
|
func NewFederationSenderInternalAPIHTTP(federationSenderURL string, httpClient *http.Client) (FederationSenderInternalAPI, error) {
|
||||||
|
if httpClient == nil {
|
||||||
|
return nil, errors.New("NewFederationSenderInternalAPIHTTP: httpClient is <nil>")
|
||||||
|
}
|
||||||
|
return &httpFederationSenderInternalAPI{federationSenderURL, httpClient}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type httpFederationSenderInternalAPI struct {
|
||||||
|
federationSenderURL string
|
||||||
|
httpClient *http.Client
|
||||||
|
}
|
56
federationsender/api/perform.go
Normal file
56
federationsender/api/perform.go
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
commonHTTP "github.com/matrix-org/dendrite/common/http"
|
||||||
|
"github.com/opentracing/opentracing-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// FederationSenderPerformJoinRequestPath is the HTTP path for the PerformJoinRequest API.
|
||||||
|
FederationSenderPerformJoinRequestPath = "/api/federationsender/performJoinRequest"
|
||||||
|
|
||||||
|
// FederationSenderPerformLeaveRequestPath is the HTTP path for the PerformLeaveRequest API.
|
||||||
|
FederationSenderPerformLeaveRequestPath = "/api/federationsender/performLeaveRequest"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PerformJoinRequest struct {
|
||||||
|
RoomID string `json:"room_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PerformJoinResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle an instruction to make_join & send_join with a remote server.
|
||||||
|
func (h *httpFederationSenderInternalAPI) PerformJoinRequest(
|
||||||
|
ctx context.Context,
|
||||||
|
request *PerformJoinRequest,
|
||||||
|
response *PerformJoinResponse,
|
||||||
|
) error {
|
||||||
|
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformJoinRequest")
|
||||||
|
defer span.Finish()
|
||||||
|
|
||||||
|
apiURL := h.federationSenderURL + FederationSenderPerformJoinRequestPath
|
||||||
|
return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||||
|
}
|
||||||
|
|
||||||
|
type PerformLeaveRequest struct {
|
||||||
|
RoomID string `json:"room_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PerformLeaveResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle an instruction to make_leave & send_leave with a remote server.
|
||||||
|
func (h *httpFederationSenderInternalAPI) PerformLeaveRequest(
|
||||||
|
ctx context.Context,
|
||||||
|
request *PerformLeaveRequest,
|
||||||
|
response *PerformLeaveResponse,
|
||||||
|
) error {
|
||||||
|
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformLeaveRequest")
|
||||||
|
defer span.Finish()
|
||||||
|
|
||||||
|
apiURL := h.federationSenderURL + FederationSenderPerformLeaveRequestPath
|
||||||
|
return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||||
|
}
|
@ -2,16 +2,20 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
commonHTTP "github.com/matrix-org/dendrite/common/http"
|
commonHTTP "github.com/matrix-org/dendrite/common/http"
|
||||||
|
"github.com/matrix-org/dendrite/federationsender/types"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/federationsender/types"
|
|
||||||
"github.com/opentracing/opentracing-go"
|
"github.com/opentracing/opentracing-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// FederationSenderQueryJoinedHostsInRoomPath is the HTTP path for the QueryJoinedHostsInRoom API.
|
||||||
|
const FederationSenderQueryJoinedHostsInRoomPath = "/api/federationsender/queryJoinedHostsInRoom"
|
||||||
|
|
||||||
|
// FederationSenderQueryJoinedHostServerNamesInRoomPath is the HTTP path for the QueryJoinedHostServerNamesInRoom API.
|
||||||
|
const FederationSenderQueryJoinedHostServerNamesInRoomPath = "/api/federationsender/queryJoinedHostServerNamesInRoom"
|
||||||
|
|
||||||
// QueryJoinedHostsInRoomRequest is a request to QueryJoinedHostsInRoom
|
// QueryJoinedHostsInRoomRequest is a request to QueryJoinedHostsInRoom
|
||||||
type QueryJoinedHostsInRoomRequest struct {
|
type QueryJoinedHostsInRoomRequest struct {
|
||||||
RoomID string `json:"room_id"`
|
RoomID string `json:"room_id"`
|
||||||
@ -22,6 +26,19 @@ type QueryJoinedHostsInRoomResponse struct {
|
|||||||
JoinedHosts []types.JoinedHost `json:"joined_hosts"`
|
JoinedHosts []types.JoinedHost `json:"joined_hosts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryJoinedHostsInRoom implements FederationSenderInternalAPI
|
||||||
|
func (h *httpFederationSenderInternalAPI) QueryJoinedHostsInRoom(
|
||||||
|
ctx context.Context,
|
||||||
|
request *QueryJoinedHostsInRoomRequest,
|
||||||
|
response *QueryJoinedHostsInRoomResponse,
|
||||||
|
) error {
|
||||||
|
span, ctx := opentracing.StartSpanFromContext(ctx, "QueryJoinedHostsInRoom")
|
||||||
|
defer span.Finish()
|
||||||
|
|
||||||
|
apiURL := h.federationSenderURL + FederationSenderQueryJoinedHostsInRoomPath
|
||||||
|
return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||||
|
}
|
||||||
|
|
||||||
// QueryJoinedHostServerNamesRequest is a request to QueryJoinedHostServerNames
|
// QueryJoinedHostServerNamesRequest is a request to QueryJoinedHostServerNames
|
||||||
type QueryJoinedHostServerNamesInRoomRequest struct {
|
type QueryJoinedHostServerNamesInRoomRequest struct {
|
||||||
RoomID string `json:"room_id"`
|
RoomID string `json:"room_id"`
|
||||||
@ -32,61 +49,8 @@ type QueryJoinedHostServerNamesInRoomResponse struct {
|
|||||||
ServerNames []gomatrixserverlib.ServerName `json:"server_names"`
|
ServerNames []gomatrixserverlib.ServerName `json:"server_names"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FederationSenderQueryAPI is used to query information from the federation sender.
|
// QueryJoinedHostServerNamesInRoom implements FederationSenderInternalAPI
|
||||||
type FederationSenderQueryAPI interface {
|
func (h *httpFederationSenderInternalAPI) QueryJoinedHostServerNamesInRoom(
|
||||||
// Query the joined hosts and the membership events accounting for their participation in a room.
|
|
||||||
// Note that if a server has multiple users in the room, it will have multiple entries in the returned slice.
|
|
||||||
// See `QueryJoinedHostServerNamesInRoom` for a de-duplicated version.
|
|
||||||
QueryJoinedHostsInRoom(
|
|
||||||
ctx context.Context,
|
|
||||||
request *QueryJoinedHostsInRoomRequest,
|
|
||||||
response *QueryJoinedHostsInRoomResponse,
|
|
||||||
) error
|
|
||||||
// Query the server names of the joined hosts in a room.
|
|
||||||
// Unlike QueryJoinedHostsInRoom, this function returns a de-duplicated slice
|
|
||||||
// containing only the server names (without information for membership events).
|
|
||||||
QueryJoinedHostServerNamesInRoom(
|
|
||||||
ctx context.Context,
|
|
||||||
request *QueryJoinedHostServerNamesInRoomRequest,
|
|
||||||
response *QueryJoinedHostServerNamesInRoomResponse,
|
|
||||||
) error
|
|
||||||
}
|
|
||||||
|
|
||||||
// FederationSenderQueryJoinedHostsInRoomPath is the HTTP path for the QueryJoinedHostsInRoom API.
|
|
||||||
const FederationSenderQueryJoinedHostsInRoomPath = "/api/federationsender/queryJoinedHostsInRoom"
|
|
||||||
|
|
||||||
// FederationSenderQueryJoinedHostServerNamesInRoomPath is the HTTP path for the QueryJoinedHostServerNamesInRoom API.
|
|
||||||
const FederationSenderQueryJoinedHostServerNamesInRoomPath = "/api/federationsender/queryJoinedHostServerNamesInRoom"
|
|
||||||
|
|
||||||
// NewFederationSenderQueryAPIHTTP creates a FederationSenderQueryAPI implemented by talking to a HTTP POST API.
|
|
||||||
// If httpClient is nil an error is returned
|
|
||||||
func NewFederationSenderQueryAPIHTTP(federationSenderURL string, httpClient *http.Client) (FederationSenderQueryAPI, error) {
|
|
||||||
if httpClient == nil {
|
|
||||||
return nil, errors.New("NewFederationSenderQueryAPIHTTP: httpClient is <nil>")
|
|
||||||
}
|
|
||||||
return &httpFederationSenderQueryAPI{federationSenderURL, httpClient}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type httpFederationSenderQueryAPI struct {
|
|
||||||
federationSenderURL string
|
|
||||||
httpClient *http.Client
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryJoinedHostsInRoom implements FederationSenderQueryAPI
|
|
||||||
func (h *httpFederationSenderQueryAPI) QueryJoinedHostsInRoom(
|
|
||||||
ctx context.Context,
|
|
||||||
request *QueryJoinedHostsInRoomRequest,
|
|
||||||
response *QueryJoinedHostsInRoomResponse,
|
|
||||||
) error {
|
|
||||||
span, ctx := opentracing.StartSpanFromContext(ctx, "QueryJoinedHostsInRoom")
|
|
||||||
defer span.Finish()
|
|
||||||
|
|
||||||
apiURL := h.federationSenderURL + FederationSenderQueryJoinedHostsInRoomPath
|
|
||||||
return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryJoinedHostServerNamesInRoom implements FederationSenderQueryAPI
|
|
||||||
func (h *httpFederationSenderQueryAPI) QueryJoinedHostServerNamesInRoom(
|
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *QueryJoinedHostServerNamesInRoomRequest,
|
request *QueryJoinedHostServerNamesInRoomRequest,
|
||||||
response *QueryJoinedHostServerNamesInRoomResponse,
|
response *QueryJoinedHostServerNamesInRoomResponse,
|
||||||
|
@ -36,7 +36,7 @@ func SetupFederationSenderComponent(
|
|||||||
federation *gomatrixserverlib.FederationClient,
|
federation *gomatrixserverlib.FederationClient,
|
||||||
rsQueryAPI roomserverAPI.RoomserverQueryAPI,
|
rsQueryAPI roomserverAPI.RoomserverQueryAPI,
|
||||||
rsInputAPI roomserverAPI.RoomserverInputAPI,
|
rsInputAPI roomserverAPI.RoomserverInputAPI,
|
||||||
) api.FederationSenderQueryAPI {
|
) api.FederationSenderInternalAPI {
|
||||||
federationSenderDB, err := storage.NewDatabase(string(base.Cfg.Database.FederationSender))
|
federationSenderDB, err := storage.NewDatabase(string(base.Cfg.Database.FederationSender))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Panic("failed to connect to federation sender db")
|
logrus.WithError(err).Panic("failed to connect to federation sender db")
|
||||||
@ -61,7 +61,7 @@ func SetupFederationSenderComponent(
|
|||||||
logrus.WithError(err).Panic("failed to start typing server consumer")
|
logrus.WithError(err).Panic("failed to start typing server consumer")
|
||||||
}
|
}
|
||||||
|
|
||||||
queryAPI := query.FederationSenderQueryAPI{
|
queryAPI := query.FederationSenderInternalAPI{
|
||||||
DB: federationSenderDB,
|
DB: federationSenderDB,
|
||||||
}
|
}
|
||||||
queryAPI.SetupHTTP(http.DefaultServeMux)
|
queryAPI.SetupHTTP(http.DefaultServeMux)
|
||||||
|
77
federationsender/query/api.go
Normal file
77
federationsender/query/api.go
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package query
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/common"
|
||||||
|
"github.com/matrix-org/dendrite/federationsender/api"
|
||||||
|
"github.com/matrix-org/dendrite/federationsender/storage"
|
||||||
|
rsAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||||
|
"github.com/matrix-org/util"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FederationSenderInternalAPI is an implementation of api.FederationSenderInternalAPI
|
||||||
|
type FederationSenderInternalAPI struct {
|
||||||
|
api.FederationSenderInternalAPI
|
||||||
|
DB storage.Database
|
||||||
|
RoomserverInputAPI rsAPI.RoomserverInputAPI
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetupHTTP adds the FederationSenderInternalAPI handlers to the http.ServeMux.
|
||||||
|
func (f *FederationSenderInternalAPI) SetupHTTP(servMux *http.ServeMux) {
|
||||||
|
servMux.Handle(
|
||||||
|
api.FederationSenderQueryJoinedHostsInRoomPath,
|
||||||
|
common.MakeInternalAPI("QueryJoinedHostsInRoom", func(req *http.Request) util.JSONResponse {
|
||||||
|
var request api.QueryJoinedHostsInRoomRequest
|
||||||
|
var response api.QueryJoinedHostsInRoomResponse
|
||||||
|
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||||
|
return util.ErrorResponse(err)
|
||||||
|
}
|
||||||
|
if err := f.QueryJoinedHostsInRoom(req.Context(), &request, &response); err != nil {
|
||||||
|
return util.ErrorResponse(err)
|
||||||
|
}
|
||||||
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
servMux.Handle(
|
||||||
|
api.FederationSenderQueryJoinedHostServerNamesInRoomPath,
|
||||||
|
common.MakeInternalAPI("QueryJoinedHostServerNamesInRoom", func(req *http.Request) util.JSONResponse {
|
||||||
|
var request api.QueryJoinedHostServerNamesInRoomRequest
|
||||||
|
var response api.QueryJoinedHostServerNamesInRoomResponse
|
||||||
|
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||||
|
return util.ErrorResponse(err)
|
||||||
|
}
|
||||||
|
if err := f.QueryJoinedHostServerNamesInRoom(req.Context(), &request, &response); err != nil {
|
||||||
|
return util.ErrorResponse(err)
|
||||||
|
}
|
||||||
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
servMux.Handle(api.FederationSenderPerformJoinRequestPath,
|
||||||
|
common.MakeInternalAPI("PerformJoinRequest", func(req *http.Request) util.JSONResponse {
|
||||||
|
var request api.PerformJoinRequest
|
||||||
|
var response api.PerformJoinResponse
|
||||||
|
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||||
|
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||||
|
}
|
||||||
|
if err := f.PerformJoinRequest(req.Context(), &request, &response); err != nil {
|
||||||
|
return util.ErrorResponse(err)
|
||||||
|
}
|
||||||
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
servMux.Handle(api.FederationSenderPerformLeaveRequestPath,
|
||||||
|
common.MakeInternalAPI("PerformLeaveRequest", func(req *http.Request) util.JSONResponse {
|
||||||
|
var request api.PerformLeaveRequest
|
||||||
|
var response api.PerformLeaveResponse
|
||||||
|
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||||
|
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||||
|
}
|
||||||
|
if err := f.PerformLeaveRequest(req.Context(), &request, &response); err != nil {
|
||||||
|
return util.ErrorResponse(err)
|
||||||
|
}
|
||||||
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
25
federationsender/query/perform.go
Normal file
25
federationsender/query/perform.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package query
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/federationsender/api"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PerformJoinRequest implements api.FederationSenderInternalAPI
|
||||||
|
func (r *FederationSenderInternalAPI) PerformJoinRequest(
|
||||||
|
ctx context.Context,
|
||||||
|
request *api.PerformJoinRequest,
|
||||||
|
response *api.PerformJoinResponse,
|
||||||
|
) (err error) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PerformLeaveRequest implements api.FederationSenderInternalAPI
|
||||||
|
func (r *FederationSenderInternalAPI) PerformLeaveRequest(
|
||||||
|
ctx context.Context,
|
||||||
|
request *api.PerformLeaveRequest,
|
||||||
|
response *api.PerformLeaveResponse,
|
||||||
|
) (err error) {
|
||||||
|
return nil
|
||||||
|
}
|
@ -2,30 +2,13 @@ package query
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/common"
|
|
||||||
"github.com/matrix-org/dendrite/federationsender/api"
|
"github.com/matrix-org/dendrite/federationsender/api"
|
||||||
"github.com/matrix-org/dendrite/federationsender/types"
|
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/matrix-org/util"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// FederationSenderQueryDatabase has the APIs needed to implement the query API.
|
// QueryJoinedHostsInRoom implements api.FederationSenderInternalAPI
|
||||||
type FederationSenderQueryDatabase interface {
|
func (f *FederationSenderInternalAPI) QueryJoinedHostsInRoom(
|
||||||
GetJoinedHosts(
|
|
||||||
ctx context.Context, roomID string,
|
|
||||||
) ([]types.JoinedHost, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FederationSenderQueryAPI is an implementation of api.FederationSenderQueryAPI
|
|
||||||
type FederationSenderQueryAPI struct {
|
|
||||||
DB FederationSenderQueryDatabase
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryJoinedHostsInRoom implements api.FederationSenderQueryAPI
|
|
||||||
func (f *FederationSenderQueryAPI) QueryJoinedHostsInRoom(
|
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *api.QueryJoinedHostsInRoomRequest,
|
request *api.QueryJoinedHostsInRoomRequest,
|
||||||
response *api.QueryJoinedHostsInRoomResponse,
|
response *api.QueryJoinedHostsInRoomResponse,
|
||||||
@ -34,8 +17,8 @@ func (f *FederationSenderQueryAPI) QueryJoinedHostsInRoom(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryJoinedHostServerNamesInRoom implements api.FederationSenderQueryAPI
|
// QueryJoinedHostServerNamesInRoom implements api.FederationSenderInternalAPI
|
||||||
func (f *FederationSenderQueryAPI) QueryJoinedHostServerNamesInRoom(
|
func (f *FederationSenderInternalAPI) QueryJoinedHostServerNamesInRoom(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *api.QueryJoinedHostServerNamesInRoomRequest,
|
request *api.QueryJoinedHostServerNamesInRoomRequest,
|
||||||
response *api.QueryJoinedHostServerNamesInRoomResponse,
|
response *api.QueryJoinedHostServerNamesInRoomResponse,
|
||||||
@ -54,35 +37,3 @@ func (f *FederationSenderQueryAPI) QueryJoinedHostServerNamesInRoom(
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetupHTTP adds the FederationSenderQueryAPI handlers to the http.ServeMux.
|
|
||||||
func (f *FederationSenderQueryAPI) SetupHTTP(servMux *http.ServeMux) {
|
|
||||||
servMux.Handle(
|
|
||||||
api.FederationSenderQueryJoinedHostsInRoomPath,
|
|
||||||
common.MakeInternalAPI("QueryJoinedHostsInRoom", func(req *http.Request) util.JSONResponse {
|
|
||||||
var request api.QueryJoinedHostsInRoomRequest
|
|
||||||
var response api.QueryJoinedHostsInRoomResponse
|
|
||||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
|
||||||
return util.ErrorResponse(err)
|
|
||||||
}
|
|
||||||
if err := f.QueryJoinedHostsInRoom(req.Context(), &request, &response); err != nil {
|
|
||||||
return util.ErrorResponse(err)
|
|
||||||
}
|
|
||||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
servMux.Handle(
|
|
||||||
api.FederationSenderQueryJoinedHostServerNamesInRoomPath,
|
|
||||||
common.MakeInternalAPI("QueryJoinedHostServerNamesInRoom", func(req *http.Request) util.JSONResponse {
|
|
||||||
var request api.QueryJoinedHostServerNamesInRoomRequest
|
|
||||||
var response api.QueryJoinedHostServerNamesInRoomResponse
|
|
||||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
|
||||||
return util.ErrorResponse(err)
|
|
||||||
}
|
|
||||||
if err := f.QueryJoinedHostServerNamesInRoom(req.Context(), &request, &response); err != nil {
|
|
||||||
return util.ErrorResponse(err)
|
|
||||||
}
|
|
||||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
commonHTTP "github.com/matrix-org/dendrite/common/http"
|
commonHTTP "github.com/matrix-org/dendrite/common/http"
|
||||||
|
fsAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
opentracing "github.com/opentracing/opentracing-go"
|
opentracing "github.com/opentracing/opentracing-go"
|
||||||
)
|
)
|
||||||
@ -106,6 +107,9 @@ type InputRoomEventsResponse struct {
|
|||||||
|
|
||||||
// RoomserverInputAPI is used to write events to the room server.
|
// RoomserverInputAPI is used to write events to the room server.
|
||||||
type RoomserverInputAPI interface {
|
type RoomserverInputAPI interface {
|
||||||
|
// needed to avoid chicken and egg scenario when setting up the
|
||||||
|
// interdependencies between the roomserver and the FS input API
|
||||||
|
SetFederationSenderAPI(fsInputAPI fsAPI.FederationSenderInternalAPI)
|
||||||
InputRoomEvents(
|
InputRoomEvents(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *InputRoomEventsRequest,
|
request *InputRoomEventsRequest,
|
||||||
@ -122,12 +126,22 @@ func NewRoomserverInputAPIHTTP(roomserverURL string, httpClient *http.Client) (R
|
|||||||
if httpClient == nil {
|
if httpClient == nil {
|
||||||
return nil, errors.New("NewRoomserverInputAPIHTTP: httpClient is <nil>")
|
return nil, errors.New("NewRoomserverInputAPIHTTP: httpClient is <nil>")
|
||||||
}
|
}
|
||||||
return &httpRoomserverInputAPI{roomserverURL, httpClient}, nil
|
return &httpRoomserverInputAPI{roomserverURL, httpClient, nil}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type httpRoomserverInputAPI struct {
|
type httpRoomserverInputAPI struct {
|
||||||
roomserverURL string
|
roomserverURL string
|
||||||
httpClient *http.Client
|
httpClient *http.Client
|
||||||
|
// The federation sender API allows us to send federation
|
||||||
|
// requests from the new perform input requests, still TODO.
|
||||||
|
fsInputAPI fsAPI.FederationSenderInternalAPI
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 *httpRoomserverInputAPI) SetFederationSenderAPI(fsInputAPI fsAPI.FederationSenderInternalAPI) {
|
||||||
|
h.fsInputAPI = fsInputAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
// InputRoomEvents implements RoomserverInputAPI
|
// InputRoomEvents implements RoomserverInputAPI
|
||||||
|
@ -26,6 +26,8 @@ import (
|
|||||||
"github.com/matrix-org/dendrite/roomserver/api"
|
"github.com/matrix-org/dendrite/roomserver/api"
|
||||||
"github.com/matrix-org/dendrite/roomserver/storage"
|
"github.com/matrix-org/dendrite/roomserver/storage"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
|
|
||||||
|
fsAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RoomserverInputAPI implements api.RoomserverInputAPI
|
// RoomserverInputAPI implements api.RoomserverInputAPI
|
||||||
@ -37,6 +39,16 @@ type RoomserverInputAPI struct {
|
|||||||
OutputRoomEventTopic string
|
OutputRoomEventTopic string
|
||||||
// Protects calls to processRoomEvent
|
// Protects calls to processRoomEvent
|
||||||
mutex sync.Mutex
|
mutex sync.Mutex
|
||||||
|
// The federation sender API allows us to send federation
|
||||||
|
// requests from the new perform input requests, still TODO.
|
||||||
|
fsAPI fsAPI.FederationSenderInternalAPI
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 (r *RoomserverInputAPI) SetFederationSenderAPI(fsAPI fsAPI.FederationSenderInternalAPI) {
|
||||||
|
r.fsAPI = fsAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteOutputEvents implements OutputRoomEventWriter
|
// WriteOutputEvents implements OutputRoomEventWriter
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
||||||
asQuery "github.com/matrix-org/dendrite/appservice/query"
|
asQuery "github.com/matrix-org/dendrite/appservice/query"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/common/basecomponent"
|
"github.com/matrix-org/dendrite/common/basecomponent"
|
||||||
"github.com/matrix-org/dendrite/roomserver/alias"
|
"github.com/matrix-org/dendrite/roomserver/alias"
|
||||||
"github.com/matrix-org/dendrite/roomserver/input"
|
"github.com/matrix-org/dendrite/roomserver/input"
|
||||||
|
Loading…
Reference in New Issue
Block a user