Implement gomatrixserverlib.HeaderedEvent in roomserver query API (#912)

* Implement gomatrixserverlib.HeaderedEvent, which should allow us to store room version headers along with the event across API boundaries and consumers/producers, and intercept unmarshalling to get the event structure right

* Add federationsender to previous
This commit is contained in:
Neil Alexander 2020-03-16 17:29:52 +00:00 committed by GitHub
parent 452f393dd7
commit acb505b717
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 163 additions and 36 deletions

View file

@ -50,7 +50,7 @@ type QueryLatestEventsAndStateResponse struct {
// This list will be in an arbitrary order.
// These are used to set the auth_events when sending an event.
// These are used to check whether the event is allowed.
StateEvents []gomatrixserverlib.Event `json:"state_events"`
StateEvents []gomatrixserverlib.HeaderedEvent `json:"state_events"`
// The depth of the latest events.
// This is one greater than the maximum depth of the latest events.
// This is used to set the depth when sending an event.
@ -79,7 +79,7 @@ type QueryStateAfterEventsResponse struct {
PrevEventsExist bool `json:"prev_events_exist"`
// The state events requested.
// This list will be in an arbitrary order.
StateEvents []gomatrixserverlib.Event `json:"state_events"`
StateEvents []gomatrixserverlib.HeaderedEvent `json:"state_events"`
}
// QueryEventsByIDRequest is a request to QueryEventsByID
@ -99,7 +99,7 @@ type QueryEventsByIDResponse struct {
// fails to read it from the database then it will fail
// the entire request.
// This list will be in an arbitrary order.
Events []gomatrixserverlib.Event `json:"events"`
Events []gomatrixserverlib.HeaderedEvent `json:"events"`
}
// QueryMembershipForUserRequest is a request to QueryMembership
@ -186,7 +186,7 @@ type QueryMissingEventsRequest struct {
// QueryMissingEventsResponse is a response to QueryMissingEvents
type QueryMissingEventsResponse struct {
// Missing events, arbritrary order.
Events []gomatrixserverlib.Event `json:"events"`
Events []gomatrixserverlib.HeaderedEvent `json:"events"`
}
// QueryStateAndAuthChainRequest is a request to QueryStateAndAuthChain
@ -212,8 +212,8 @@ type QueryStateAndAuthChainResponse struct {
PrevEventsExist bool `json:"prev_events_exist"`
// The state and auth chain events that were requested.
// The lists will be in an arbitrary order.
StateEvents []gomatrixserverlib.Event `json:"state_events"`
AuthChainEvents []gomatrixserverlib.Event `json:"auth_chain_events"`
StateEvents []gomatrixserverlib.HeaderedEvent `json:"state_events"`
AuthChainEvents []gomatrixserverlib.HeaderedEvent `json:"auth_chain_events"`
}
// QueryBackfillRequest is a request to QueryBackfill.
@ -229,7 +229,7 @@ type QueryBackfillRequest struct {
// QueryBackfillResponse is a response to QueryBackfill.
type QueryBackfillResponse struct {
// Missing events, arbritrary order.
Events []gomatrixserverlib.Event `json:"events"`
Events []gomatrixserverlib.HeaderedEvent `json:"events"`
}
// QueryServersInRoomAtEventRequest is a request to QueryServersInRoomAtEvent