diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-08-25 12:32:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-25 12:32:29 +0100 |
commit | c8b873abc8cb20227774c648b7a774214c8f3752 (patch) | |
tree | 78e7cf34b4fc8625cc6458fead0fd2adee5114a2 /roomserver/storage/sqlite3/storage.go | |
parent | 05242096a17ab432878f777c64240c2a3d5b367c (diff) |
Roomserver NID caches (#1335)
* Initial work on roomserver NID caches
* Give caches to roomserver storage
* Populate caches
* Fix bugs
* Fix WASM build
* Don't hit cache twice in RoomNIDExcludingStubs
* Store reverse room ID-room NID mapping, consult caches when assigning NIDs
Diffstat (limited to 'roomserver/storage/sqlite3/storage.go')
-rw-r--r-- | roomserver/storage/sqlite3/storage.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/roomserver/storage/sqlite3/storage.go b/roomserver/storage/sqlite3/storage.go index d1738966..87dce6ad 100644 --- a/roomserver/storage/sqlite3/storage.go +++ b/roomserver/storage/sqlite3/storage.go @@ -19,6 +19,7 @@ import ( "context" "database/sql" + "github.com/matrix-org/dendrite/internal/caching" "github.com/matrix-org/dendrite/internal/config" "github.com/matrix-org/dendrite/internal/sqlutil" "github.com/matrix-org/dendrite/roomserver/storage/shared" @@ -46,7 +47,7 @@ type Database struct { // Open a sqlite database. // nolint: gocyclo -func Open(dbProperties *config.DatabaseOptions) (*Database, error) { +func Open(dbProperties *config.DatabaseOptions, cache caching.RoomServerCaches) (*Database, error) { var d Database var err error if d.db, err = sqlutil.Open(dbProperties); err != nil { @@ -120,6 +121,7 @@ func Open(dbProperties *config.DatabaseOptions) (*Database, error) { } d.Database = shared.Database{ DB: d.db, + Cache: cache, Writer: sqlutil.NewExclusiveWriter(), EventsTable: d.events, EventTypesTable: d.eventTypes, |