Refactor roomserver/internal - split perform stuff out (#1380)

- New package `perform` which contains all `Perform` functions
- New package `helpers` which contains helper functions used by both
  perform and query/input functions.
- Perform invite/leave have no idea how to `WriteOutputEvents` and this
  is now returned from `PerformInvite` or `PerformLeave` respectively.

Still to do:
 - RSAPI is fed into the inviter/joiner/leaver - this introduces circular
   logic so will need to be removed.
 - Put query operations in a `query` package.
 - Put input operations (and output) in an `input` package.
 - Factor out helper functions as much as possible, possibly rejigging the
   storage layer in the process.
This commit is contained in:
Kegsay 2020-09-02 13:47:31 +01:00 committed by GitHub
parent 02a73f29f8
commit e473320e73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 820 additions and 647 deletions

View file

@ -47,14 +47,8 @@ func NewInternalAPI(
logrus.WithError(err).Panicf("failed to connect to room server db")
}
return &internal.RoomserverInternalAPI{
DB: roomserverDB,
Cfg: cfg,
Producer: base.KafkaProducer,
OutputRoomEventTopic: string(cfg.Matrix.Kafka.TopicFor(config.TopicOutputRoomEvent)),
Cache: base.Caches,
ServerName: cfg.Matrix.ServerName,
FedClient: fedClient,
KeyRing: keyRing,
}
return internal.NewRoomserverAPI(
cfg, roomserverDB, base.KafkaProducer, string(cfg.Matrix.Kafka.TopicFor(config.TopicOutputRoomEvent)),
base.Caches, fedClient, keyRing,
)
}