Skip to main content

resolve

Function resolve 

Source
pub async fn resolve<States, AuthSets, FetchExists, ExistsFut, FetchEvent, EventFut, Pdu>(
    rules: &RoomVersionRules,
    state_maps: States,
    auth_sets: AuthSets,
    fetch: &FetchEvent,
    exists: &FetchExists,
    backport_css: bool,
) -> Result<StateMap<OwnedEventId>>
where States: Stream<Item = StateMap<OwnedEventId>> + Send, AuthSets: Stream<Item = AuthSet<OwnedEventId>> + Send, FetchExists: Fn(OwnedEventId) -> ExistsFut + Sync, ExistsFut: Future<Output = bool> + Send, FetchEvent: Fn(OwnedEventId) -> EventFut + Sync, EventFut: Future<Output = Result<Pdu>> + Send, Pdu: Event + Clone,
Expand description

Apply the state resolution algorithm introduced in room version 2 to resolve the state of a room.

§Arguments

  • rules - The rules to apply for the version of the current room.

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

  • auth_chains - The list of full recursive sets of auth_events for each event in the state_maps.

  • fetch_event - Function to fetch an event in the room given its event ID.

§Invariants

The caller of resolve must ensure that all the events are from the same room.

§Returns

The resolved room state.