aboutsummaryrefslogtreecommitdiff
path: root/roomserver/storage/interface.go
diff options
context:
space:
mode:
Diffstat (limited to 'roomserver/storage/interface.go')
-rw-r--r--roomserver/storage/interface.go41
1 files changed, 39 insertions, 2 deletions
diff --git a/roomserver/storage/interface.go b/roomserver/storage/interface.go
index 50369d80..0235e51e 100644
--- a/roomserver/storage/interface.go
+++ b/roomserver/storage/interface.go
@@ -18,13 +18,50 @@ import (
"context"
"github.com/matrix-org/dendrite/roomserver/api"
- statedb "github.com/matrix-org/dendrite/roomserver/state/database"
"github.com/matrix-org/dendrite/roomserver/types"
"github.com/matrix-org/gomatrixserverlib"
)
type Database interface {
- statedb.RoomStateDatabase
+ // Store the room state at an event in the database
+ AddState(
+ ctx context.Context,
+ roomNID types.RoomNID,
+ stateBlockNIDs []types.StateBlockNID,
+ state []types.StateEntry,
+ ) (types.StateSnapshotNID, error)
+ // Look up the state of a room at each event for a list of string event IDs.
+ // Returns an error if there is an error talking to the database
+ // Returns a types.MissingEventError if the room state for the event IDs aren't in the database
+ StateAtEventIDs(ctx context.Context, eventIDs []string) ([]types.StateAtEvent, error)
+ // Look up the numeric IDs for a list of string event types.
+ // Returns a map from string event type to numeric ID for the event type.
+ EventTypeNIDs(ctx context.Context, eventTypes []string) (map[string]types.EventTypeNID, error)
+ // Look up the numeric IDs for a list of string event state keys.
+ // Returns a map from string state key to numeric ID for the state key.
+ EventStateKeyNIDs(ctx context.Context, eventStateKeys []string) (map[string]types.EventStateKeyNID, error)
+ // Look up the numeric state data IDs for each numeric state snapshot ID
+ // The returned slice is sorted by numeric state snapshot ID.
+ StateBlockNIDs(ctx context.Context, stateNIDs []types.StateSnapshotNID) ([]types.StateBlockNIDList, error)
+ // Look up the state data for each numeric state data ID
+ // The returned slice is sorted by numeric state data ID.
+ StateEntries(ctx context.Context, stateBlockNIDs []types.StateBlockNID) ([]types.StateEntryList, error)
+ // Look up the state data for the state key tuples for each numeric state block ID
+ // This is used to fetch a subset of the room state at a snapshot.
+ // If a block doesn't contain any of the requested tuples then it can be discarded from the result.
+ // The returned slice is sorted by numeric state block ID.
+ StateEntriesForTuples(
+ ctx context.Context,
+ stateBlockNIDs []types.StateBlockNID,
+ stateKeyTuples []types.StateKeyTuple,
+ ) ([]types.StateEntryList, error)
+ // Look up the Events for a list of numeric event IDs.
+ // Returns a sorted list of events.
+ Events(ctx context.Context, eventNIDs []types.EventNID) ([]types.Event, error)
+ // Look up snapshot NID for an event ID string
+ SnapshotNIDFromEventID(ctx context.Context, eventID string) (types.StateSnapshotNID, error)
+ // Look up a room version from the room NID.
+ GetRoomVersionForRoomNID(ctx context.Context, roomNID types.RoomNID) (gomatrixserverlib.RoomVersion, error)
StoreEvent(ctx context.Context, event gomatrixserverlib.Event, txnAndSessionID *api.TransactionID, authEventNIDs []types.EventNID) (types.RoomNID, types.StateAtEvent, error)
StateEntriesForEventIDs(ctx context.Context, eventIDs []string) ([]types.StateEntry, error)
EventStateKeys(ctx context.Context, eventStateKeyNIDs []types.EventStateKeyNID) (map[types.EventStateKeyNID]string, error)