Function ruma::state_res::resolve

source ·
pub fn resolve<'a, E, SetIter>(
    room_version: &RoomVersionId,
    state_sets: impl IntoIterator<IntoIter = SetIter>,
    auth_chain_sets: Vec<HashSet<<E as Event>::Id>>,
    fetch_event: impl Fn(&EventId) -> Option<E>,
) -> Result<HashMap<(StateEventType, String), <E as Event>::Id>, Error>
where E: Event + Clone, <E as Event>::Id: 'a, SetIter: Iterator<Item = &'a HashMap<(StateEventType, String), <E as Event>::Id>> + Clone,
Available on crate feature state-res only.
Expand description

Resolve sets of state events as they come in.

Internally StateResolution builds a graph and an auth chain to allow for state conflict resolution.

§Arguments

  • state_sets - The incoming state to resolve. Each StateMap represents a possible fork in the state of a room.

  • auth_chain_sets - The full recursive set of auth_events for each event in the state_sets.

  • fetch_event - Any event not found in the event_map will defer to this closure to find the event.

§Invariants

The caller of resolve must ensure that all the events are from the same room. Although this function takes a RoomId it does not check that each event is part of the same room.