mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 14:53:10 -06:00
rename FSAPI's PerformPeek as PerformOutboundPeek
This commit is contained in:
parent
8f203febc1
commit
3caae7913b
|
|
@ -33,7 +33,7 @@ func Peek(
|
|||
roomID, peekID string,
|
||||
remoteVersions []gomatrixserverlib.RoomVersion,
|
||||
) util.JSONResponse {
|
||||
// TODO: check if we're just refreshing an existing peek. Somehow.
|
||||
// TODO: check if we're just refreshing an existing peek by querying the federationsender
|
||||
|
||||
verReq := api.QueryRoomVersionForRoomRequest{RoomID: roomID}
|
||||
verRes := api.QueryRoomVersionForRoomResponse{}
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@ type FederationSenderInternalAPI interface {
|
|||
response *PerformJoinResponse,
|
||||
)
|
||||
// Handle an instruction to peek a room on a remote server.
|
||||
PerformPeek(
|
||||
PerformOutboundPeek(
|
||||
ctx context.Context,
|
||||
request *PerformPeekRequest,
|
||||
response *PerformPeekResponse,
|
||||
request *PerformOutboundPeekRequest,
|
||||
response *PerformOutboundPeekResponse,
|
||||
) error
|
||||
// Handle an instruction to make_leave & send_leave with a remote server.
|
||||
PerformLeave(
|
||||
|
|
@ -111,13 +111,13 @@ type PerformJoinResponse struct {
|
|||
LastError *gomatrix.HTTPError
|
||||
}
|
||||
|
||||
type PerformPeekRequest struct {
|
||||
type PerformOutboundPeekRequest struct {
|
||||
RoomID string `json:"room_id"`
|
||||
// The sorted list of servers to try. Servers will be tried sequentially, after de-duplication.
|
||||
ServerNames types.ServerNames `json:"server_names"`
|
||||
}
|
||||
|
||||
type PerformPeekResponse struct {
|
||||
type PerformOutboundPeekResponse struct {
|
||||
LastError *gomatrix.HTTPError
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -208,11 +208,11 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer(
|
|||
return nil
|
||||
}
|
||||
|
||||
// PerformPeekRequest implements api.FederationSenderInternalAPI
|
||||
func (r *FederationSenderInternalAPI) PerformPeek(
|
||||
// PerformOutboundPeekRequest implements api.FederationSenderInternalAPI
|
||||
func (r *FederationSenderInternalAPI) PerformOutboundPeek(
|
||||
ctx context.Context,
|
||||
request *api.PerformPeekRequest,
|
||||
response *api.PerformPeekResponse,
|
||||
request *api.PerformOutboundPeekRequest,
|
||||
response *api.PerformOutboundPeekResponse,
|
||||
) error {
|
||||
// Look up the supported room versions.
|
||||
var supportedVersions []gomatrixserverlib.RoomVersion
|
||||
|
|
@ -238,7 +238,7 @@ func (r *FederationSenderInternalAPI) PerformPeek(
|
|||
// successfully completes the peek
|
||||
var lastErr error
|
||||
for _, serverName := range request.ServerNames {
|
||||
if err := r.performPeekUsingServer(
|
||||
if err := r.performOutboundPeekUsingServer(
|
||||
ctx,
|
||||
request.RoomID,
|
||||
serverName,
|
||||
|
|
@ -279,7 +279,7 @@ func (r *FederationSenderInternalAPI) PerformPeek(
|
|||
return lastErr
|
||||
}
|
||||
|
||||
func (r *FederationSenderInternalAPI) performPeekUsingServer(
|
||||
func (r *FederationSenderInternalAPI) performOutboundPeekUsingServer(
|
||||
ctx context.Context,
|
||||
roomID string,
|
||||
serverName gomatrixserverlib.ServerName,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const (
|
|||
FederationSenderPerformJoinRequestPath = "/federationsender/performJoinRequest"
|
||||
FederationSenderPerformLeaveRequestPath = "/federationsender/performLeaveRequest"
|
||||
FederationSenderPerformInviteRequestPath = "/federationsender/performInviteRequest"
|
||||
FederationSenderPerformPeekRequestPath = "/federationsender/performPeekRequest"
|
||||
FederationSenderPerformOutboundPeekRequestPath = "/federationsender/performOutboundPeekRequest"
|
||||
FederationSenderPerformServersAlivePath = "/federationsender/performServersAlive"
|
||||
FederationSenderPerformBroadcastEDUPath = "/federationsender/performBroadcastEDU"
|
||||
|
||||
|
|
@ -74,15 +74,15 @@ func (h *httpFederationSenderInternalAPI) PerformInvite(
|
|||
}
|
||||
|
||||
// Handle starting a peek on a remote server.
|
||||
func (h *httpFederationSenderInternalAPI) PerformPeek(
|
||||
func (h *httpFederationSenderInternalAPI) PerformOutboundPeek(
|
||||
ctx context.Context,
|
||||
request *api.PerformPeekRequest,
|
||||
response *api.PerformPeekResponse,
|
||||
request *api.PerformOutboundPeekRequest,
|
||||
response *api.PerformOutboundPeekResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformPeekRequest")
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformOutboundPeekRequest")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.federationSenderURL + FederationSenderPerformPeekRequestPath
|
||||
apiURL := h.federationSenderURL + FederationSenderPerformOutboundPeekRequestPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -1,5 +1,7 @@
|
|||
module github.com/matrix-org/dendrite
|
||||
|
||||
replace github.com/matrix-org/gomatrixserverlib => ../gomatrixserverlib
|
||||
|
||||
require (
|
||||
github.com/Shopify/sarama v1.27.0
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const (
|
|||
OutputTypeNewPeek OutputType = "new_peek"
|
||||
|
||||
// OutputTypeNewInboundPeek indicates that the kafka event is an OutputNewInboundPeek
|
||||
OutputTypeNewInboundPeek OutputType = "new_remote_peek"
|
||||
OutputTypeNewInboundPeek OutputType = "new_inbound_peek"
|
||||
)
|
||||
|
||||
// An OutputEvent is an entry in the roomserver output kafka log.
|
||||
|
|
@ -70,7 +70,7 @@ type OutputEvent struct {
|
|||
// The content of event with type OutputTypeNewPeek
|
||||
NewPeek *OutputNewPeek `json:"new_peek,omitempty"`
|
||||
// The content of event with type OutputTypeNewInboundPeek
|
||||
NewInboundPeek *OutputNewInboundPeek `json:"new_remote_peek,omitempty"`
|
||||
NewInboundPeek *OutputNewInboundPeek `json:"new_inbound_peek,omitempty"`
|
||||
}
|
||||
|
||||
// An OutputNewRoomEvent is written when the roomserver receives a new event.
|
||||
|
|
|
|||
|
|
@ -159,12 +159,12 @@ func (r *Peeker) performPeekRoomByID(
|
|||
req.ServerNames = append(req.ServerNames, domain)
|
||||
|
||||
// Try peeking by all of the supplied server names.
|
||||
fedReq := fsAPI.PerformPeekRequest{
|
||||
fedReq := fsAPI.PerformOutboundPeekRequest{
|
||||
RoomID: req.RoomIDOrAlias, // the room ID to try and peek
|
||||
ServerNames: req.ServerNames, // the servers to try peeking via
|
||||
}
|
||||
fedRes := fsAPI.PerformPeekResponse{}
|
||||
r.FSAPI.PerformPeek(ctx, &fedReq, &fedRes)
|
||||
fedRes := fsAPI.PerformOutboundPeekResponse{}
|
||||
r.FSAPI.PerformOutboundPeek(ctx, &fedReq, &fedRes)
|
||||
if fedRes.LastError != nil {
|
||||
return "", &api.PerformError{
|
||||
Code: api.PerformErrRemote,
|
||||
|
|
|
|||
Loading…
Reference in a new issue