mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Rename common/ refs to typing
This commit is contained in:
parent
5ab8e8caf2
commit
ad54af38e0
|
|
@ -38,11 +38,11 @@ func main() {
|
|||
asQuery := base.CreateHTTPAppServiceAPIs()
|
||||
alias, input, query := base.CreateHTTPRoomserverAPIs()
|
||||
fedSenderAPI := base.CreateHTTPFederationSenderAPIs()
|
||||
typingInputAPI := eduserver.SetupTypingServerComponent(base, cache.NewTypingCache())
|
||||
eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New())
|
||||
|
||||
clientapi.SetupClientAPIComponent(
|
||||
base, deviceDB, accountDB, federation, &keyRing,
|
||||
alias, input, query, typingInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
||||
alias, input, query, eduInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
||||
)
|
||||
|
||||
base.SetupAndServeHTTP(string(base.Cfg.Bind.ClientAPI), string(base.Cfg.Listen.ClientAPI))
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ func main() {
|
|||
keyRing := keydb.CreateKeyRing(federation.Client, keyDB)
|
||||
|
||||
alias, input, query := roomserver.SetupRoomServerComponent(base)
|
||||
typingInputAPI := eduserver.SetupTypingServerComponent(base, cache.NewTypingCache())
|
||||
eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New())
|
||||
asQuery := appservice.SetupAppServiceAPIComponent(
|
||||
base, accountDB, deviceDB, federation, alias, query, transactions.New(),
|
||||
)
|
||||
|
|
@ -65,7 +65,7 @@ func main() {
|
|||
clientapi.SetupClientAPIComponent(
|
||||
base, deviceDB, accountDB,
|
||||
federation, &keyRing, alias, input, query,
|
||||
typingInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
||||
eduInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
||||
)
|
||||
federationapi.SetupFederationAPIComponent(base, accountDB, deviceDB, federation, &keyRing, alias, input, query, asQuery, fedSenderAPI)
|
||||
mediaapi.SetupMediaAPIComponent(base, deviceDB)
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ import (
|
|||
"github.com/matrix-org/dendrite/common/basecomponent"
|
||||
"github.com/matrix-org/dendrite/common/config"
|
||||
"github.com/matrix-org/dendrite/common/transactions"
|
||||
"github.com/matrix-org/dendrite/eduserver"
|
||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||
"github.com/matrix-org/dendrite/federationapi"
|
||||
"github.com/matrix-org/dendrite/federationsender"
|
||||
"github.com/matrix-org/dendrite/mediaapi"
|
||||
"github.com/matrix-org/dendrite/publicroomsapi"
|
||||
"github.com/matrix-org/dendrite/roomserver"
|
||||
"github.com/matrix-org/dendrite/syncapi"
|
||||
"github.com/matrix-org/dendrite/eduserver"
|
||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||
"github.com/matrix-org/go-http-js-libp2p/go_http_js_libp2p"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ func main() {
|
|||
p2pPublicRoomProvider := NewLibP2PPublicRoomsProvider(node)
|
||||
|
||||
alias, input, query := roomserver.SetupRoomServerComponent(base)
|
||||
typingInputAPI := eduserver.SetupTypingServerComponent(base, cache.NewTypingCache())
|
||||
eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New())
|
||||
asQuery := appservice.SetupAppServiceAPIComponent(
|
||||
base, accountDB, deviceDB, federation, alias, query, transactions.New(),
|
||||
)
|
||||
|
|
@ -131,7 +131,7 @@ func main() {
|
|||
clientapi.SetupClientAPIComponent(
|
||||
base, deviceDB, accountDB,
|
||||
federation, &keyRing, alias, input, query,
|
||||
typingInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
||||
eduInputAPI, asQuery, transactions.New(), fedSenderAPI,
|
||||
)
|
||||
federationapi.SetupFederationAPIComponent(base, accountDB, deviceDB, federation, &keyRing, alias, input, query, asQuery, fedSenderAPI)
|
||||
mediaapi.SetupMediaAPIComponent(base, deviceDB)
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ import (
|
|||
|
||||
appserviceAPI "github.com/matrix-org/dendrite/appservice/api"
|
||||
"github.com/matrix-org/dendrite/common/config"
|
||||
eduServerAPI "github.com/matrix-org/dendrite/eduserver/api"
|
||||
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||
typingServerAPI "github.com/matrix-org/dendrite/eduserver/api"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
|
@ -111,10 +111,10 @@ func (b *BaseDendrite) CreateHTTPRoomserverAPIs() (
|
|||
return alias, input, query
|
||||
}
|
||||
|
||||
// CreateHTTPTypingServerAPIs returns typingInputAPI for hitting the typing
|
||||
// CreateHTTPEDUServerAPIs returns typingInputAPI for hitting the typing
|
||||
// server over HTTP
|
||||
func (b *BaseDendrite) CreateHTTPTypingServerAPIs() typingServerAPI.TypingServerInputAPI {
|
||||
return typingServerAPI.NewTypingServerInputAPIHTTP(b.Cfg.TypingServerURL(), nil)
|
||||
func (b *BaseDendrite) CreateHTTPEDUServerAPIs() eduServerAPI.TypingServerInputAPI {
|
||||
return eduServerAPI.NewTypingServerInputAPIHTTP(b.Cfg.EDUServerURL(), nil)
|
||||
}
|
||||
|
||||
// CreateHTTPFederationSenderAPIs returns FederationSenderQueryAPI for hitting
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ type Dendrite struct {
|
|||
RoomServer Address `yaml:"room_server"`
|
||||
FederationSender Address `yaml:"federation_sender"`
|
||||
PublicRoomsAPI Address `yaml:"public_rooms_api"`
|
||||
TypingServer Address `yaml:"typing_server"`
|
||||
EDUServer Address `yaml:"edu_server"`
|
||||
} `yaml:"bind"`
|
||||
|
||||
// The addresses for talking to other microservices.
|
||||
|
|
@ -219,7 +219,7 @@ type Dendrite struct {
|
|||
RoomServer Address `yaml:"room_server"`
|
||||
FederationSender Address `yaml:"federation_sender"`
|
||||
PublicRoomsAPI Address `yaml:"public_rooms_api"`
|
||||
TypingServer Address `yaml:"typing_server"`
|
||||
EDUServer Address `yaml:"edu_server"`
|
||||
} `yaml:"listen"`
|
||||
|
||||
// The config for tracing the dendrite servers.
|
||||
|
|
@ -571,7 +571,7 @@ func (config *Dendrite) checkListen(configErrs *configErrors) {
|
|||
checkNotEmpty(configErrs, "listen.federation_api", string(config.Listen.FederationAPI))
|
||||
checkNotEmpty(configErrs, "listen.sync_api", string(config.Listen.SyncAPI))
|
||||
checkNotEmpty(configErrs, "listen.room_server", string(config.Listen.RoomServer))
|
||||
checkNotEmpty(configErrs, "listen.typing_server", string(config.Listen.TypingServer))
|
||||
checkNotEmpty(configErrs, "listen.edu_server", string(config.Listen.EDUServer))
|
||||
}
|
||||
|
||||
// checkLogging verifies the parameters logging.* are valid.
|
||||
|
|
@ -669,7 +669,7 @@ func fingerprintPEM(data []byte) *gomatrixserverlib.TLSFingerprint {
|
|||
|
||||
// AppServiceURL returns a HTTP URL for where the appservice component is listening.
|
||||
func (config *Dendrite) AppServiceURL() string {
|
||||
// Hard code the roomserver to talk HTTP for now.
|
||||
// Hard code the appservice server to talk HTTP for now.
|
||||
// If we support HTTPS we need to think of a practical way to do certificate validation.
|
||||
// People setting up servers shouldn't need to get a certificate valid for the public
|
||||
// internet for an internal API.
|
||||
|
|
@ -685,18 +685,18 @@ func (config *Dendrite) RoomServerURL() string {
|
|||
return "http://" + string(config.Listen.RoomServer)
|
||||
}
|
||||
|
||||
// TypingServerURL returns an HTTP URL for where the typing server is listening.
|
||||
func (config *Dendrite) TypingServerURL() string {
|
||||
// Hard code the typing server to talk HTTP for now.
|
||||
// EDUServerURL returns an HTTP URL for where the EDU server is listening.
|
||||
func (config *Dendrite) EDUServerURL() string {
|
||||
// Hard code the EDU server to talk HTTP for now.
|
||||
// If we support HTTPS we need to think of a practical way to do certificate validation.
|
||||
// People setting up servers shouldn't need to get a certificate valid for the public
|
||||
// internet for an internal API.
|
||||
return "http://" + string(config.Listen.TypingServer)
|
||||
return "http://" + string(config.Listen.EDUServer)
|
||||
}
|
||||
|
||||
// FederationSenderURL returns an HTTP URL for where the federation sender is listening.
|
||||
func (config *Dendrite) FederationSenderURL() string {
|
||||
// Hard code the typing server to talk HTTP for now.
|
||||
// Hard code the federation sender server to talk HTTP for now.
|
||||
// If we support HTTPS we need to think of a practical way to do certificate validation.
|
||||
// People setting up servers shouldn't need to get a certificate valid for the public
|
||||
// internet for an internal API.
|
||||
|
|
|
|||
4
eduserver/cache/cache.go
vendored
4
eduserver/cache/cache.go
vendored
|
|
@ -49,8 +49,8 @@ func (t *TypingCache) newRoomData() *roomData {
|
|||
}
|
||||
}
|
||||
|
||||
// NewTypingCache returns a new TypingCache initialised for use.
|
||||
func NewTypingCache() *TypingCache {
|
||||
// New returns a new TypingCache initialised for use.
|
||||
func New() *TypingCache {
|
||||
return &TypingCache{data: make(map[string]*roomData)}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,16 +21,16 @@ import (
|
|||
"github.com/matrix-org/dendrite/eduserver/input"
|
||||
)
|
||||
|
||||
// SetupTypingServerComponent sets up and registers HTTP handlers for the
|
||||
// TypingServer component. Returns instances of the various roomserver APIs,
|
||||
// SetupEDUServerComponent sets up and registers HTTP handlers for the
|
||||
// EDUServer component. Returns instances of the various roomserver APIs,
|
||||
// allowing other components running in the same process to hit the query the
|
||||
// APIs directly instead of having to use HTTP.
|
||||
func SetupTypingServerComponent(
|
||||
func SetupEDUServerComponent(
|
||||
base *basecomponent.BaseDendrite,
|
||||
typingCache *cache.TypingCache,
|
||||
eduCache *cache.TypingCache,
|
||||
) api.TypingServerInputAPI {
|
||||
inputAPI := &input.TypingServerInputAPI{
|
||||
Cache: typingCache,
|
||||
Cache: eduCache,
|
||||
Producer: base.KafkaProducer,
|
||||
OutputTypingEventTopic: string(base.Cfg.Kafka.Topics.OutputTypingEvent),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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/syncapi/types"
|
||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ type SyncServerDatasource struct {
|
|||
events outputRoomEventsStatements
|
||||
roomstate currentRoomStateStatements
|
||||
invites inviteEventsStatements
|
||||
typingCache *cache.TypingCache
|
||||
eduCache *cache.TypingCache
|
||||
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/syncapi/types"
|
||||
"github.com/matrix-org/dendrite/eduserver/cache"
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ type SyncServerDatasource struct {
|
|||
events outputRoomEventsStatements
|
||||
roomstate currentRoomStateStatements
|
||||
invites inviteEventsStatements
|
||||
typingCache *cache.TypingCache
|
||||
eduCache *cache.TypingCache
|
||||
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…
Reference in a new issue