mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Only require room version instead of room info for db.Events() (#3079)
This reduces the API requirements for the Events database to align with what is actually required.
This commit is contained in:
parent
2b34f88fde
commit
a49c9f01e2
16 changed files with 74 additions and 36 deletions
|
@ -41,7 +41,7 @@ type StateResolutionStorage interface {
|
|||
StateEntriesForTuples(ctx context.Context, stateBlockNIDs []types.StateBlockNID, stateKeyTuples []types.StateKeyTuple) ([]types.StateEntryList, error)
|
||||
StateAtEventIDs(ctx context.Context, eventIDs []string) ([]types.StateAtEvent, error)
|
||||
AddState(ctx context.Context, roomNID types.RoomNID, stateBlockNIDs []types.StateBlockNID, state []types.StateEntry) (types.StateSnapshotNID, error)
|
||||
Events(ctx context.Context, roomInfo *types.RoomInfo, eventNIDs []types.EventNID) ([]types.Event, error)
|
||||
Events(ctx context.Context, roomVersion gomatrixserverlib.RoomVersion, eventNIDs []types.EventNID) ([]types.Event, error)
|
||||
EventsFromIDs(ctx context.Context, roomInfo *types.RoomInfo, eventIDs []string) ([]types.Event, error)
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,10 @@ func (p *StateResolution) Resolve(ctx context.Context, eventID string) (*gomatri
|
|||
return nil, fmt.Errorf("unable to find power level event")
|
||||
}
|
||||
|
||||
events, err := p.db.Events(ctx, p.roomInfo, []types.EventNID{plNID})
|
||||
if p.roomInfo == nil {
|
||||
return nil, types.ErrorInvalidRoomInfo
|
||||
}
|
||||
events, err := p.db.Events(ctx, p.roomInfo.RoomVersion, []types.EventNID{plNID})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1134,7 +1137,11 @@ func (v *StateResolution) loadStateEvents(
|
|||
eventNIDs = append(eventNIDs, entry.EventNID)
|
||||
}
|
||||
}
|
||||
events, err := v.db.Events(ctx, v.roomInfo, eventNIDs)
|
||||
|
||||
if v.roomInfo == nil {
|
||||
return nil, nil, types.ErrorInvalidRoomInfo
|
||||
}
|
||||
events, err := v.db.Events(ctx, v.roomInfo.RoomVersion, eventNIDs)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue