From 5b468ec16598344f4563ba794cf8bddb5ddebd23 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 17 May 2017 17:19:55 +0100 Subject: [PATCH] s/Roomserver/NewOutputRoomEvent/ --- .../dendrite/cmd/dendrite-sync-api-server/main.go | 2 +- .../dendrite/syncapi/consumers/roomserver.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/cmd/dendrite-sync-api-server/main.go b/src/github.com/matrix-org/dendrite/cmd/dendrite-sync-api-server/main.go index 0b96377b6..5d1bf8e2e 100644 --- a/src/github.com/matrix-org/dendrite/cmd/dendrite-sync-api-server/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/dendrite-sync-api-server/main.go @@ -81,7 +81,7 @@ func main() { if err := n.Load(db); err != nil { log.Panicf("startup: failed to set up notifier: %s", err) } - consumer, err := consumers.NewRoomserver(cfg, n, db) + consumer, err := consumers.NewOutputRoomEvent(cfg, n, db) if err != nil { log.Panicf("startup: failed to create room server consumer: %s", err) } diff --git a/src/github.com/matrix-org/dendrite/syncapi/consumers/roomserver.go b/src/github.com/matrix-org/dendrite/syncapi/consumers/roomserver.go index 4229289e5..b8ec98d2c 100644 --- a/src/github.com/matrix-org/dendrite/syncapi/consumers/roomserver.go +++ b/src/github.com/matrix-org/dendrite/syncapi/consumers/roomserver.go @@ -28,15 +28,15 @@ import ( sarama "gopkg.in/Shopify/sarama.v1" ) -// Roomserver consumes events that originated in the room server. -type Roomserver struct { +// OutputRoomEvent consumes events that originated in the room server. +type OutputRoomEvent struct { roomServerConsumer *common.ContinualConsumer db *storage.SyncServerDatabase notifier *sync.Notifier } -// NewRoomserver creates a new room server consumer. Call Start() to begin consuming from room servers. -func NewRoomserver(cfg *config.Sync, n *sync.Notifier, store *storage.SyncServerDatabase) (*Roomserver, error) { +// NewOutputRoomEvent creates a new OutputRoomEvent consumer. Call Start() to begin consuming from room servers. +func NewOutputRoomEvent(cfg *config.Sync, n *sync.Notifier, store *storage.SyncServerDatabase) (*OutputRoomEvent, error) { kafkaConsumer, err := sarama.NewConsumer(cfg.KafkaConsumerURIs, nil) if err != nil { return nil, err @@ -47,7 +47,7 @@ func NewRoomserver(cfg *config.Sync, n *sync.Notifier, store *storage.SyncServer Consumer: kafkaConsumer, PartitionStore: store, } - s := &Roomserver{ + s := &OutputRoomEvent{ roomServerConsumer: &consumer, db: store, notifier: n, @@ -58,14 +58,14 @@ func NewRoomserver(cfg *config.Sync, n *sync.Notifier, store *storage.SyncServer } // Start consuming from room servers -func (s *Roomserver) Start() error { +func (s *OutputRoomEvent) Start() error { return s.roomServerConsumer.Start() } // onMessage is called when the sync server receives a new event from the room server output log. // It is not safe for this function to be called from multiple goroutines, or else the // sync stream position may race and be incorrectly calculated. -func (s *Roomserver) onMessage(msg *sarama.ConsumerMessage) error { +func (s *OutputRoomEvent) onMessage(msg *sarama.ConsumerMessage) error { // Parse out the event JSON var output api.OutputRoomEvent if err := json.Unmarshal(msg.Value, &output); err != nil {