mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-03 14:42:47 +00:00
Slowly begin to unpick storage functions
This commit is contained in:
parent
c992f4f1f4
commit
2e1374057b
10 changed files with 99 additions and 195 deletions
|
@ -86,15 +86,15 @@ func (v StateResolution) LoadStateAtSnapshot(
|
|||
func (v StateResolution) LoadStateAtEvent(
|
||||
ctx context.Context, eventID string,
|
||||
) ([]types.StateEntry, error) {
|
||||
snapshotNID, err := v.db.SnapshotNIDFromEventID(ctx, eventID)
|
||||
stateAtEvents, err := v.db.StateAtEventIDs(ctx, []string{eventID})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("LoadStateAtEvent.SnapshotNIDFromEventID failed for event %s : %s", eventID, err)
|
||||
}
|
||||
if snapshotNID == 0 {
|
||||
if len(stateAtEvents) == 0 || stateAtEvents[0].BeforeStateSnapshotNID == 0 {
|
||||
return nil, fmt.Errorf("LoadStateAtEvent.SnapshotNIDFromEventID(%s) returned 0 NID, was this event stored?", eventID)
|
||||
}
|
||||
|
||||
stateEntries, err := v.LoadStateAtSnapshot(ctx, snapshotNID)
|
||||
stateEntries, err := v.LoadStateAtSnapshot(ctx, stateAtEvents[0].BeforeStateSnapshotNID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue