aboutsummaryrefslogtreecommitdiff
path: root/federationsender
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-11-19 11:34:59 +0000
committerGitHub <noreply@github.com>2020-11-19 11:34:59 +0000
commit6353b0b7e42d65d92368b93c021b3a744c03214b (patch)
tree6c8268bf6e133092aadf903bc989906d430f1c66 /federationsender
parent1cf9f20d2f740864a48bfb3465f686f4bfe61591 (diff)
MSC2836: Threading - part one (#1589)
* Add mscs/hooks package, begin work for msc2836 * Flesh out hooks and add SQL schema * Begin implementing core msc2836 logic * Add test harness * Linting * Implement visibility checks; stub out APIs for tests * Flesh out testing * Flesh out walkThread a bit * Persist the origin_server_ts as well * Edges table instead of relationships * Add nodes table for event metadata * LEFT JOIN to extract origin_server_ts for children * Add graph walking structs * Implement walking algorithm * Add more graph walking tests * Add auto_join for local rooms * Fix create table syntax on postgres * Add relationship_room_id|servers to the unsigned section of events * Persist the parent room_id/servers in edge metadata Other events cannot assert the true room_id/servers for the parent event, only make claims to them, hence why this is edge metadata. * guts to pass through room_id/servers * Refactor msc2836 to allow handling from federation * Add JoinedVia to PerformJoin responses * Fix tests; review comments
Diffstat (limited to 'federationsender')
-rw-r--r--federationsender/api/api.go2
-rw-r--r--federationsender/internal/perform.go1
-rw-r--r--federationsender/internal/query.go11
3 files changed, 5 insertions, 9 deletions
diff --git a/federationsender/api/api.go b/federationsender/api/api.go
index b0522516..a4d15f1f 100644
--- a/federationsender/api/api.go
+++ b/federationsender/api/api.go
@@ -48,6 +48,7 @@ type FederationSenderInternalAPI interface {
// 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).
+ // The response will include this server if they are joined to the room.
QueryJoinedHostServerNamesInRoom(
ctx context.Context,
request *QueryJoinedHostServerNamesInRoomRequest,
@@ -104,6 +105,7 @@ type PerformJoinRequest struct {
}
type PerformJoinResponse struct {
+ JoinedVia gomatrixserverlib.ServerName
LastError *gomatrix.HTTPError
}
diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go
index a7484476..45f33ff7 100644
--- a/federationsender/internal/perform.go
+++ b/federationsender/internal/perform.go
@@ -105,6 +105,7 @@ func (r *FederationSenderInternalAPI) PerformJoin(
}
// We're all good.
+ response.JoinedVia = serverName
return
}
diff --git a/federationsender/internal/query.go b/federationsender/internal/query.go
index 253400a2..8ba228d1 100644
--- a/federationsender/internal/query.go
+++ b/federationsender/internal/query.go
@@ -4,7 +4,6 @@ import (
"context"
"github.com/matrix-org/dendrite/federationsender/api"
- "github.com/matrix-org/gomatrixserverlib"
)
// QueryJoinedHostServerNamesInRoom implements api.FederationSenderInternalAPI
@@ -13,17 +12,11 @@ func (f *FederationSenderInternalAPI) QueryJoinedHostServerNamesInRoom(
request *api.QueryJoinedHostServerNamesInRoomRequest,
response *api.QueryJoinedHostServerNamesInRoomResponse,
) (err error) {
- joinedHosts, err := f.db.GetJoinedHosts(ctx, request.RoomID)
+ joinedHosts, err := f.db.GetJoinedHostsForRooms(ctx, []string{request.RoomID})
if err != nil {
return
}
-
- response.ServerNames = make([]gomatrixserverlib.ServerName, 0, len(joinedHosts))
- for _, host := range joinedHosts {
- response.ServerNames = append(response.ServerNames, host.ServerName)
- }
-
- // TODO: remove duplicates?
+ response.ServerNames = joinedHosts
return
}