mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Rename the typing server to EDU server (#948)
* Blunt move and sed rename * Rename common/ refs to typing * Rename internal stuff in eduserver * Rename docs and scripts * Rename constants/filenames, goimports everything to re-order imports
This commit is contained in:
parent
f72b759426
commit
11a8059bba
30 changed files with 153 additions and 153 deletions
|
@ -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/typingserver/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/typingserver/cache"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ import (
|
|||
// Import the postgres database driver.
|
||||
_ "github.com/lib/pq"
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
"github.com/matrix-org/dendrite/typingserver/cache"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
|
@ -53,7 +53,7 @@ type SyncServerDatasource struct {
|
|||
events outputRoomEventsStatements
|
||||
roomstate currentRoomStateStatements
|
||||
invites inviteEventsStatements
|
||||
typingCache *cache.TypingCache
|
||||
eduCache *cache.EDUCache
|
||||
topology outputRoomEventsTopologyStatements
|
||||
backwardExtremities backwardExtremitiesStatements
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ func NewSyncServerDatasource(dbDataSourceName string) (*SyncServerDatasource, er
|
|||
if err := d.backwardExtremities.prepare(d.db); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
d.typingCache = cache.NewTypingCache()
|
||||
d.eduCache = cache.New()
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ func (d *SyncServerDatasource) syncPositionTx(
|
|||
maxEventID = maxInviteID
|
||||
}
|
||||
sp.PDUPosition = types.StreamPosition(maxEventID)
|
||||
sp.EDUTypingPosition = types.StreamPosition(d.typingCache.GetLatestSyncPosition())
|
||||
sp.EDUTypingPosition = types.StreamPosition(d.eduCache.GetLatestSyncPosition())
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ func (d *SyncServerDatasource) addTypingDeltaToResponse(
|
|||
var ok bool
|
||||
var err error
|
||||
for _, roomID := range joinedRoomIDs {
|
||||
if typingUsers, updated := d.typingCache.GetTypingUsersIfUpdatedAfter(
|
||||
if typingUsers, updated := d.eduCache.GetTypingUsersIfUpdatedAfter(
|
||||
roomID, int64(since.EDUTypingPosition),
|
||||
); updated {
|
||||
ev := gomatrixserverlib.ClientEvent{
|
||||
|
@ -719,7 +719,7 @@ func (d *SyncServerDatasource) RetireInviteEvent(
|
|||
}
|
||||
|
||||
func (d *SyncServerDatasource) SetTypingTimeoutCallback(fn cache.TimeoutCallbackFn) {
|
||||
d.typingCache.SetTimeoutCallback(fn)
|
||||
d.eduCache.SetTimeoutCallback(fn)
|
||||
}
|
||||
|
||||
// AddTypingUser adds a typing user to the typing cache.
|
||||
|
@ -727,7 +727,7 @@ func (d *SyncServerDatasource) SetTypingTimeoutCallback(fn cache.TimeoutCallback
|
|||
func (d *SyncServerDatasource) AddTypingUser(
|
||||
userID, roomID string, expireTime *time.Time,
|
||||
) types.StreamPosition {
|
||||
return types.StreamPosition(d.typingCache.AddTypingUser(userID, roomID, expireTime))
|
||||
return types.StreamPosition(d.eduCache.AddTypingUser(userID, roomID, expireTime))
|
||||
}
|
||||
|
||||
// RemoveTypingUser removes a typing user from the typing cache.
|
||||
|
@ -735,7 +735,7 @@ func (d *SyncServerDatasource) AddTypingUser(
|
|||
func (d *SyncServerDatasource) RemoveTypingUser(
|
||||
userID, roomID string,
|
||||
) types.StreamPosition {
|
||||
return types.StreamPosition(d.typingCache.RemoveUser(userID, roomID))
|
||||
return types.StreamPosition(d.eduCache.RemoveUser(userID, roomID))
|
||||
}
|
||||
|
||||
func (d *SyncServerDatasource) addInvitesToResponse(
|
||||
|
|
|
@ -33,8 +33,8 @@ import (
|
|||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
"github.com/matrix-org/dendrite/typingserver/cache"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
|
@ -57,7 +57,7 @@ type SyncServerDatasource struct {
|
|||
events outputRoomEventsStatements
|
||||
roomstate currentRoomStateStatements
|
||||
invites inviteEventsStatements
|
||||
typingCache *cache.TypingCache
|
||||
eduCache *cache.EDUCache
|
||||
topology outputRoomEventsTopologyStatements
|
||||
backwardExtremities backwardExtremitiesStatements
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ func NewSyncServerDatasource(dataSourceName string) (*SyncServerDatasource, erro
|
|||
if err = d.prepare(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
d.typingCache = cache.NewTypingCache()
|
||||
d.eduCache = cache.New()
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ func (d *SyncServerDatasource) syncPositionTx(
|
|||
maxEventID = maxInviteID
|
||||
}
|
||||
sp.PDUPosition = types.StreamPosition(maxEventID)
|
||||
sp.EDUTypingPosition = types.StreamPosition(d.typingCache.GetLatestSyncPosition())
|
||||
sp.EDUTypingPosition = types.StreamPosition(d.eduCache.GetLatestSyncPosition())
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ func (d *SyncServerDatasource) addTypingDeltaToResponse(
|
|||
var ok bool
|
||||
var err error
|
||||
for _, roomID := range joinedRoomIDs {
|
||||
if typingUsers, updated := d.typingCache.GetTypingUsersIfUpdatedAfter(
|
||||
if typingUsers, updated := d.eduCache.GetTypingUsersIfUpdatedAfter(
|
||||
roomID, int64(since.EDUTypingPosition),
|
||||
); updated {
|
||||
ev := gomatrixserverlib.ClientEvent{
|
||||
|
@ -766,7 +766,7 @@ func (d *SyncServerDatasource) RetireInviteEvent(
|
|||
}
|
||||
|
||||
func (d *SyncServerDatasource) SetTypingTimeoutCallback(fn cache.TimeoutCallbackFn) {
|
||||
d.typingCache.SetTimeoutCallback(fn)
|
||||
d.eduCache.SetTimeoutCallback(fn)
|
||||
}
|
||||
|
||||
// AddTypingUser adds a typing user to the typing cache.
|
||||
|
@ -774,7 +774,7 @@ func (d *SyncServerDatasource) SetTypingTimeoutCallback(fn cache.TimeoutCallback
|
|||
func (d *SyncServerDatasource) AddTypingUser(
|
||||
userID, roomID string, expireTime *time.Time,
|
||||
) types.StreamPosition {
|
||||
return types.StreamPosition(d.typingCache.AddTypingUser(userID, roomID, expireTime))
|
||||
return types.StreamPosition(d.eduCache.AddTypingUser(userID, roomID, expireTime))
|
||||
}
|
||||
|
||||
// RemoveTypingUser removes a typing user from the typing cache.
|
||||
|
@ -782,7 +782,7 @@ func (d *SyncServerDatasource) AddTypingUser(
|
|||
func (d *SyncServerDatasource) RemoveTypingUser(
|
||||
userID, roomID string,
|
||||
) types.StreamPosition {
|
||||
return types.StreamPosition(d.typingCache.RemoveUser(userID, roomID))
|
||||
return types.StreamPosition(d.eduCache.RemoveUser(userID, roomID))
|
||||
}
|
||||
|
||||
func (d *SyncServerDatasource) addInvitesToResponse(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue