Update readme add docs
This commit is contained in:
parent
43e0f20d3b
commit
07807974f7
13
README.md
13
README.md
@ -16,14 +16,15 @@ pub type StateMap<T> = BTreeMap<(EventType, String), T>;
|
|||||||
pub type EventMap<T> = BTreeMap<EventId, T>;
|
pub type EventMap<T> = BTreeMap<EventId, T>;
|
||||||
|
|
||||||
struct StateResolution {
|
struct StateResolution {
|
||||||
// For now the StateResolution struct is empty. If "caching `event_map` between `resolve` calls
|
// For now the StateResolution struct is empty. If "caching" `event_map`
|
||||||
// ends up being more efficient it may have an `event_map` field.
|
// 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 {
|
impl StateResolution {
|
||||||
/// The point of this all, resolve the possibly conflicting sets of events.
|
/// The point of this all, resolve the possibly conflicting sets of events.
|
||||||
pub fn resolve(
|
pub fn resolve(
|
||||||
&self,
|
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
room_version: &RoomVersionId,
|
room_version: &RoomVersionId,
|
||||||
state_sets: &[StateMap<EventId>],
|
state_sets: &[StateMap<EventId>],
|
||||||
@ -38,9 +39,9 @@ trait StateStore {
|
|||||||
/// Return a single event based on the EventId.
|
/// Return a single event based on the EventId.
|
||||||
fn get_event(&self, event_id: &EventId) -> Result<StateEvent, String>;
|
fn get_event(&self, event_id: &EventId) -> Result<StateEvent, String>;
|
||||||
|
|
||||||
// There are 3 methods that have default implementations `get_events`, `auth_event_ids` and
|
// There are 3 methods that have default implementations `get_events`,
|
||||||
// `auth_chain_diff`. Each could be overridden if the user has an optimization with their database of
|
// `auth_event_ids` and `auth_chain_diff`. Each could be overridden if
|
||||||
// choice.
|
// the user has an optimization with their database of choice.
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -301,8 +301,9 @@ impl StateResolution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Events are sorted from "earliest" to "latest". They are compared using
|
/// Events are sorted from "earliest" to "latest". They are compared using
|
||||||
/// the negative power level, the origin server timestamp and incase of a
|
/// the negative power level (reverse topological ordering), the
|
||||||
/// tie the `EventId`s are compared lexicographically.
|
/// 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
|
/// The power level is negative because a higher power level is equated to an
|
||||||
/// earlier (further back in time) origin server timestamp.
|
/// earlier (further back in time) origin server timestamp.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user