Update readme add docs

This commit is contained in:
Devin Ragotzy 2020-08-21 07:39:02 -04:00
parent 43e0f20d3b
commit 07807974f7
2 changed files with 10 additions and 8 deletions

View File

@ -16,14 +16,15 @@ pub type StateMap<T> = BTreeMap<(EventType, String), T>;
pub type EventMap<T> = BTreeMap<EventId, T>;
struct StateResolution {
// For now the StateResolution struct is empty. If "caching `event_map` between `resolve` calls
// ends up being more efficient it may have an `event_map` field.
// For now the StateResolution struct is empty. If "caching" `event_map`
// between `resolve` calls nds up being more efficient (probably not as this would eat memory)
// it may have an `event_map` field. The `event_map` is all the event's
// `StateResolution` has to know about in order to resolve state.
}
impl StateResolution {
/// The point of this all, resolve the possibly conflicting sets of events.
pub fn resolve(
&self,
room_id: &RoomId,
room_version: &RoomVersionId,
state_sets: &[StateMap<EventId>],
@ -38,9 +39,9 @@ trait StateStore {
/// Return a single event based on the EventId.
fn get_event(&self, event_id: &EventId) -> Result<StateEvent, String>;
// There are 3 methods that have default implementations `get_events`, `auth_event_ids` and
// `auth_chain_diff`. Each could be overridden if the user has an optimization with their database of
// choice.
// There are 3 methods that have default implementations `get_events`,
// `auth_event_ids` and `auth_chain_diff`. Each could be overridden if
// the user has an optimization with their database of choice.
}
```

View File

@ -301,8 +301,9 @@ impl StateResolution {
}
/// Events are sorted from "earliest" to "latest". They are compared using
/// the negative power level, the origin server timestamp and incase of a
/// tie the `EventId`s are compared lexicographically.
/// the negative power level (reverse topological ordering), the
/// origin server timestamp and incase of a tie the `EventId`s
/// are compared lexicographically.
///
/// The power level is negative because a higher power level is equated to an
/// earlier (further back in time) origin server timestamp.