mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Rename constants/filenames, goimports everything to re-order imports
This commit is contained in:
parent
195db37052
commit
2a669e7c9a
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
func main() {
|
||||
cfg := basecomponent.ParseFlags()
|
||||
base := basecomponent.NewBaseDendrite(cfg, "TypingServerAPI")
|
||||
base := basecomponent.NewBaseDendrite(cfg, "EDUServerAPI")
|
||||
defer func() {
|
||||
if err := base.Close(); err != nil {
|
||||
logrus.WithError(err).Warn("BaseDendrite close failed")
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ kafka:
|
|||
topics:
|
||||
output_room_event: roomserverOutput
|
||||
output_client_data: clientapiOutput
|
||||
output_typing_event: typingServerOutput
|
||||
output_typing_event: eduServerOutput
|
||||
user_updates: userUpdates
|
||||
|
||||
# The postgres connection configs for connecting to the databases e.g a postgres:// URI
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ kafka:
|
|||
topics:
|
||||
output_room_event: roomserverOutput
|
||||
output_client_data: clientapiOutput
|
||||
output_typing_event: typingServerOutput
|
||||
output_typing_event: eduServerOutput
|
||||
user_updates: userUpdates
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,15 +18,15 @@ import (
|
|||
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
"github.com/matrix-org/dendrite/common/config"
|
||||
"github.com/matrix-org/dendrite/eduserver/api"
|
||||
"github.com/matrix-org/dendrite/federationsender/queue"
|
||||
"github.com/matrix-org/dendrite/federationsender/storage"
|
||||
"github.com/matrix-org/dendrite/eduserver/api"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gopkg.in/Shopify/sarama.v1"
|
||||
)
|
||||
|
||||
// OutputTypingEventConsumer consumes events that originate in typing server.
|
||||
// OutputTypingEventConsumer consumes events that originate in EDU server.
|
||||
type OutputTypingEventConsumer struct {
|
||||
consumer *common.ContinualConsumer
|
||||
db storage.Database
|
||||
|
|
@ -34,7 +34,7 @@ type OutputTypingEventConsumer struct {
|
|||
ServerName gomatrixserverlib.ServerName
|
||||
}
|
||||
|
||||
// NewOutputTypingEventConsumer creates a new OutputTypingEventConsumer. Call Start() to begin consuming from typing servers.
|
||||
// NewOutputTypingEventConsumer creates a new OutputTypingEventConsumer. Call Start() to begin consuming from EDU servers.
|
||||
func NewOutputTypingEventConsumer(
|
||||
cfg *config.Dendrite,
|
||||
kafkaConsumer sarama.Consumer,
|
||||
|
|
@ -57,12 +57,12 @@ func NewOutputTypingEventConsumer(
|
|||
return c
|
||||
}
|
||||
|
||||
// Start consuming from typing servers
|
||||
// Start consuming from EDU servers
|
||||
func (t *OutputTypingEventConsumer) Start() error {
|
||||
return t.consumer.Start()
|
||||
}
|
||||
|
||||
// onMessage is called for OutputTypingEvent received from the typing servers.
|
||||
// onMessage is called for OutputTypingEvent received from the EDU servers.
|
||||
// Parses the msg, creates a matrix federation EDU and sends it to joined hosts.
|
||||
func (t *OutputTypingEventConsumer) onMessage(msg *sarama.ConsumerMessage) error {
|
||||
// Extract the typing event from msg.
|
||||
|
|
@ -19,15 +19,15 @@ import (
|
|||
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
"github.com/matrix-org/dendrite/common/config"
|
||||
"github.com/matrix-org/dendrite/eduserver/api"
|
||||
"github.com/matrix-org/dendrite/syncapi/storage"
|
||||
"github.com/matrix-org/dendrite/syncapi/sync"
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
"github.com/matrix-org/dendrite/eduserver/api"
|
||||
log "github.com/sirupsen/logrus"
|
||||
sarama "gopkg.in/Shopify/sarama.v1"
|
||||
)
|
||||
|
||||
// OutputTypingEventConsumer consumes events that originated in the typing server.
|
||||
// OutputTypingEventConsumer consumes events that originated in the EDU server.
|
||||
type OutputTypingEventConsumer struct {
|
||||
typingConsumer *common.ContinualConsumer
|
||||
db storage.Database
|
||||
|
|
@ -35,7 +35,7 @@ type OutputTypingEventConsumer struct {
|
|||
}
|
||||
|
||||
// NewOutputTypingEventConsumer creates a new OutputTypingEventConsumer.
|
||||
// Call Start() to begin consuming from the typing server.
|
||||
// Call Start() to begin consuming from the EDU server.
|
||||
func NewOutputTypingEventConsumer(
|
||||
cfg *config.Dendrite,
|
||||
kafkaConsumer sarama.Consumer,
|
||||
|
|
@ -60,7 +60,7 @@ func NewOutputTypingEventConsumer(
|
|||
return s
|
||||
}
|
||||
|
||||
// Start consuming from typing api
|
||||
// Start consuming from EDU api
|
||||
func (s *OutputTypingEventConsumer) Start() error {
|
||||
s.db.SetTypingTimeoutCallback(func(userID, roomID string, latestSyncPosition int64) {
|
||||
s.notifier.OnNewEvent(
|
||||
|
|
@ -78,7 +78,7 @@ func (s *OutputTypingEventConsumer) onMessage(msg *sarama.ConsumerMessage) error
|
|||
var output api.OutputTypingEvent
|
||||
if err := json.Unmarshal(msg.Value, &output); err != nil {
|
||||
// If the message was invalid, log it and move on to the next message in the stream
|
||||
log.WithError(err).Errorf("typing server output log: message parse failure")
|
||||
log.WithError(err).Errorf("EDU server output log: message parse failure")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ func (s *OutputTypingEventConsumer) onMessage(msg *sarama.ConsumerMessage) error
|
|||
"room_id": output.Event.RoomID,
|
||||
"user_id": output.Event.UserID,
|
||||
"typing": output.Event.Typing,
|
||||
}).Debug("received data from typing server")
|
||||
}).Debug("received data from EDU server")
|
||||
|
||||
var typingPos types.StreamPosition
|
||||
typingEvent := output.Event
|
||||
|
|
@ -20,9 +20,9 @@ import (
|
|||
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue