mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 11:53:09 -06:00
Rename Input to Perform
This commit is contained in:
parent
63b28c1a31
commit
17999e2149
|
|
@ -25,16 +25,16 @@ type FederationSenderInternalAPI interface {
|
||||||
response *QueryJoinedHostServerNamesInRoomResponse,
|
response *QueryJoinedHostServerNamesInRoomResponse,
|
||||||
) error
|
) error
|
||||||
// Handle an instruction to make_join & send_join with a remote server.
|
// Handle an instruction to make_join & send_join with a remote server.
|
||||||
InputJoinRequest(
|
PerformJoinRequest(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *InputJoinRequest,
|
request *PerformJoinRequest,
|
||||||
response *InputJoinResponse,
|
response *PerformJoinResponse,
|
||||||
) error
|
) error
|
||||||
// Handle an instruction to make_leave & send_leave with a remote server.
|
// Handle an instruction to make_leave & send_leave with a remote server.
|
||||||
InputLeaveRequest(
|
PerformLeaveRequest(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *InputLeaveRequest,
|
request *PerformLeaveRequest,
|
||||||
response *InputLeaveResponse,
|
response *PerformLeaveResponse,
|
||||||
) error
|
) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
package api
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
commonHTTP "github.com/matrix-org/dendrite/common/http"
|
|
||||||
"github.com/opentracing/opentracing-go"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
FederationSenderInputJoinRequestPath = "/api/federationsender/inputJoinRequest"
|
|
||||||
FederationSenderInputLeaveRequestPath = "/api/federationsender/inputLeaveRequest"
|
|
||||||
)
|
|
||||||
|
|
||||||
type InputJoinRequest struct {
|
|
||||||
RoomID string `json:"room_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type InputJoinResponse struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle an instruction to make_join & send_join with a remote server.
|
|
||||||
func (h *httpFederationSenderInternalAPI) InputJoinRequest(
|
|
||||||
ctx context.Context,
|
|
||||||
request *InputJoinRequest,
|
|
||||||
response *InputJoinResponse,
|
|
||||||
) error {
|
|
||||||
span, ctx := opentracing.StartSpanFromContext(ctx, "InputJoinRequest")
|
|
||||||
defer span.Finish()
|
|
||||||
|
|
||||||
apiURL := h.federationSenderURL + FederationSenderInputJoinRequestPath
|
|
||||||
return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
|
||||||
}
|
|
||||||
|
|
||||||
type InputLeaveRequest struct {
|
|
||||||
RoomID string `json:"room_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type InputLeaveResponse struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle an instruction to make_leave & send_leave with a remote server.
|
|
||||||
func (h *httpFederationSenderInternalAPI) InputLeaveRequest(
|
|
||||||
ctx context.Context,
|
|
||||||
request *InputLeaveRequest,
|
|
||||||
response *InputLeaveResponse,
|
|
||||||
) error {
|
|
||||||
span, ctx := opentracing.StartSpanFromContext(ctx, "InputLeaveRequest")
|
|
||||||
defer span.Finish()
|
|
||||||
|
|
||||||
apiURL := h.federationSenderURL + FederationSenderInputLeaveRequestPath
|
|
||||||
return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
|
||||||
}
|
|
||||||
53
federationsender/api/perform.go
Normal file
53
federationsender/api/perform.go
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
commonHTTP "github.com/matrix-org/dendrite/common/http"
|
||||||
|
"github.com/opentracing/opentracing-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
FederationSenderPerformJoinRequestPath = "/api/federationsender/inputJoinRequest"
|
||||||
|
FederationSenderPerformLeaveRequestPath = "/api/federationsender/inputLeaveRequest"
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
@ -56,27 +56,27 @@ func (f *FederationSenderInternalAPI) SetupHTTP(servMux *http.ServeMux) {
|
||||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
servMux.Handle(api.FederationSenderInputJoinRequestPath,
|
servMux.Handle(api.FederationSenderPerformJoinRequestPath,
|
||||||
common.MakeInternalAPI("inputJoinRequest", func(req *http.Request) util.JSONResponse {
|
common.MakeInternalAPI("inputJoinRequest", func(req *http.Request) util.JSONResponse {
|
||||||
var request api.InputJoinRequest
|
var request api.PerformJoinRequest
|
||||||
var response api.InputJoinResponse
|
var response api.PerformJoinResponse
|
||||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||||
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||||
}
|
}
|
||||||
if err := f.InputJoinRequest(req.Context(), &request, &response); err != nil {
|
if err := f.PerformJoinRequest(req.Context(), &request, &response); err != nil {
|
||||||
return util.ErrorResponse(err)
|
return util.ErrorResponse(err)
|
||||||
}
|
}
|
||||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
servMux.Handle(api.FederationSenderInputLeaveRequestPath,
|
servMux.Handle(api.FederationSenderPerformLeaveRequestPath,
|
||||||
common.MakeInternalAPI("inputLeaveRequest", func(req *http.Request) util.JSONResponse {
|
common.MakeInternalAPI("inputLeaveRequest", func(req *http.Request) util.JSONResponse {
|
||||||
var request api.InputLeaveRequest
|
var request api.PerformLeaveRequest
|
||||||
var response api.InputLeaveResponse
|
var response api.PerformLeaveResponse
|
||||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||||
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||||
}
|
}
|
||||||
if err := f.InputLeaveRequest(req.Context(), &request, &response); err != nil {
|
if err := f.PerformLeaveRequest(req.Context(), &request, &response); err != nil {
|
||||||
return util.ErrorResponse(err)
|
return util.ErrorResponse(err)
|
||||||
}
|
}
|
||||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package query
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/federationsender/api"
|
|
||||||
)
|
|
||||||
|
|
||||||
// InputJoinRequest implements api.FederationSenderInternalAPI
|
|
||||||
func (r *FederationSenderInternalAPI) InputJoinRequest(
|
|
||||||
ctx context.Context,
|
|
||||||
request *api.InputJoinRequest,
|
|
||||||
response *api.InputJoinResponse,
|
|
||||||
) (err error) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputLeaveRequest implements api.FederationSenderInternalAPI
|
|
||||||
func (r *FederationSenderInternalAPI) InputLeaveRequest(
|
|
||||||
ctx context.Context,
|
|
||||||
request *api.InputLeaveRequest,
|
|
||||||
response *api.InputLeaveResponse,
|
|
||||||
) (err error) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
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
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue