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

Method LoadStateAtSnapshotForStringTuples

roomserver/state/state.go:290–303  ·  view source on GitHub ↗

LoadStateAtSnapshotForStringTuples loads the state for a list of event type and state key pairs at a snapshot. This is used when we only want to load a subset of the room state at a snapshot. If there is no entry for a given event type and state key pair then it will be discarded. This is typically

(
	ctx context.Context,
	stateNID types.StateSnapshotNID,
	stateKeyTuples []gomatrixserverlib.StateKeyTuple,
)

Source from the content-addressed store, hash-verified

288// This is typically the state before an event or the current state of a room.
289// Returns a sorted list of state entries or an error if there was a problem talking to the database.
290func (v *StateResolution) LoadStateAtSnapshotForStringTuples(
291 ctx context.Context,
292 stateNID types.StateSnapshotNID,
293 stateKeyTuples []gomatrixserverlib.StateKeyTuple,
294) ([]types.StateEntry, error) {
295 span, ctx := opentracing.StartSpanFromContext(ctx, "StateResolution.LoadStateAtSnapshotForStringTuples")
296 defer span.Finish()
297
298 numericTuples, err := v.stringTuplesToNumericTuples(ctx, stateKeyTuples)
299 if err != nil {
300 return nil, err
301 }
302 return v.loadStateAtSnapshotForNumericTuples(ctx, stateNID, numericTuples)
303}
304
305// stringTuplesToNumericTuples converts the string state key tuples into numeric IDs
306// If there isn't a numeric ID for either the event type or the event state key then the tuple is discarded.

Callers 2

buildInviteStrippedStateFunction · 0.95

Tested by

no test coverage detected