diff options
author | Kegsay <kegan@matrix.org> | 2020-05-26 18:23:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-26 18:23:39 +0100 |
commit | 19aa44ecaef70a2be7294e8ad738467da41d1f2e (patch) | |
tree | e823357e7de9fad4bd20b39a4efb7d72975d3743 /roomserver/storage/tables | |
parent | 803af87dc49f6db57019892215c6c6cf049b5c50 (diff) |
Convert transactions/rooms table to share more code (#1063)
* Convert rooms table
* Convert transactions table
* Convert rooms table and factor out lots of functions
* I think you'll be needing this..
Diffstat (limited to 'roomserver/storage/tables')
-rw-r--r-- | roomserver/storage/tables/interface.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/roomserver/storage/tables/interface.go b/roomserver/storage/tables/interface.go index 78ddc5fe..e913de6b 100644 --- a/roomserver/storage/tables/interface.go +++ b/roomserver/storage/tables/interface.go @@ -53,5 +53,20 @@ type Events interface { // If an event ID is not in the database then it is omitted from the map. BulkSelectEventNID(ctx context.Context, eventIDs []string) (map[string]types.EventNID, error) SelectMaxEventDepth(ctx context.Context, txn *sql.Tx, eventNIDs []types.EventNID) (int64, error) - SelectRoomNIDForEventNID(ctx context.Context, txn *sql.Tx, eventNID types.EventNID) (roomNID types.RoomNID, err error) + SelectRoomNIDForEventNID(ctx context.Context, eventNID types.EventNID) (roomNID types.RoomNID, err error) +} + +type Rooms interface { + InsertRoomNID(ctx context.Context, txn *sql.Tx, roomID string, roomVersion gomatrixserverlib.RoomVersion) (types.RoomNID, error) + SelectRoomNID(ctx context.Context, txn *sql.Tx, roomID string) (types.RoomNID, error) + SelectLatestEventNIDs(ctx context.Context, txn *sql.Tx, roomNID types.RoomNID) ([]types.EventNID, types.StateSnapshotNID, error) + SelectLatestEventsNIDsForUpdate(ctx context.Context, txn *sql.Tx, roomNID types.RoomNID) ([]types.EventNID, types.EventNID, types.StateSnapshotNID, error) + UpdateLatestEventNIDs(ctx context.Context, txn *sql.Tx, roomNID types.RoomNID, eventNIDs []types.EventNID, lastEventSentNID types.EventNID, stateSnapshotNID types.StateSnapshotNID) error + SelectRoomVersionForRoomID(ctx context.Context, txn *sql.Tx, roomID string) (gomatrixserverlib.RoomVersion, error) + SelectRoomVersionForRoomNID(ctx context.Context, roomNID types.RoomNID) (gomatrixserverlib.RoomVersion, error) +} + +type Transactions interface { + InsertTransaction(ctx context.Context, txn *sql.Tx, transactionID string, sessionID int64, userID string, eventID string) error + SelectTransactionEventID(ctx context.Context, transactionID string, sessionID int64, userID string) (eventID string, err error) } |