MCPcopy Create free account
hub / github.com/daodst/chat / isPrevStateKnown

Method isPrevStateKnown

roomserver/internal/input/input_missing.go:609–626  ·  view source on GitHub ↗
(ctx context.Context, e *gomatrixserverlib.Event)

Source from the content-addressed store, hash-verified

607}
608
609func (t *missingStateReq) isPrevStateKnown(ctx context.Context, e *gomatrixserverlib.Event) bool {
610 expected := len(e.PrevEventIDs())
611 state, err := t.db.StateAtEventIDs(ctx, e.PrevEventIDs())
612 if err != nil || len(state) != expected {
613 // We didn't get as many state snapshots as we expected, or there was an error,
614 // so we haven't completely solved the problem for the new event.
615 return false
616 }
617 // Check to see if we have a populated state snapshot for all of the prev events.
618 for _, stateAtEvent := range state {
619 if stateAtEvent.BeforeStateSnapshotNID == 0 {
620 // One of the prev events still has unknown state, so we haven't really
621 // solved the problem.
622 return false
623 }
624 }
625 return true
626}
627
628func (t *missingStateReq) lookupMissingStateViaState(
629 ctx context.Context, roomID, eventID string, roomVersion gomatrixserverlib.RoomVersion,

Callers 2

getMissingEventsMethod · 0.95

Calls 2

PrevEventIDsMethod · 0.80
StateAtEventIDsMethod · 0.65

Tested by

no test coverage detected