mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
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:
parent
452f393dd7
commit
acb505b717
21 changed files with 163 additions and 36 deletions
|
@ -22,6 +22,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/common/config"
|
||||
"github.com/matrix-org/dendrite/publicroomsapi/storage"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
log "github.com/sirupsen/logrus"
|
||||
sarama "gopkg.in/Shopify/sarama.v1"
|
||||
)
|
||||
|
@ -98,5 +99,13 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return s.db.UpdateRoomFromEvents(context.TODO(), addQueryRes.Events, remQueryRes.Events)
|
||||
var addQueryEvents, remQueryEvents []gomatrixserverlib.Event
|
||||
for _, headeredEvent := range addQueryRes.Events {
|
||||
addQueryEvents = append(addQueryEvents, headeredEvent.Event)
|
||||
}
|
||||
for _, headeredEvent := range remQueryRes.Events {
|
||||
remQueryEvents = append(remQueryEvents, headeredEvent.Event)
|
||||
}
|
||||
|
||||
return s.db.UpdateRoomFromEvents(context.TODO(), addQueryEvents, remQueryEvents)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue