Keep track of State at event for state resolution

feat: first steps towards joining rooms over federation
Add state-res as a dependency of conduit
Add reverse_topological_power_sort before append_pdu
Implement statehashstatid_pduid tree for keeping track of state
Clean up implementation of state_hash as key for tracking state
This commit is contained in:
Devin Ragotzy 2020-08-06 08:29:59 -04:00
parent 8e55623bde
commit c4f5a0a631
24 changed files with 818 additions and 356 deletions

View file

@ -1,5 +1,8 @@
use crate::Error;
use ruma::identifiers::{DeviceId, UserId};
use ruma::{
api::IncomingRequest,
identifiers::{DeviceId, UserId},
};
use std::{convert::TryInto, ops::Deref};
#[cfg(feature = "conduit_bin")]
@ -16,13 +19,12 @@ use {
tokio::io::AsyncReadExt,
Request, State,
},
ruma::api::IncomingRequest,
std::io::Cursor,
};
/// This struct converts rocket requests into ruma structs by converting them into http requests
/// first.
pub struct Ruma<T> {
pub struct Ruma<T: IncomingRequest> {
pub body: T,
pub sender_id: Option<UserId>,
pub device_id: Option<Box<DeviceId>>,
@ -110,7 +112,7 @@ impl<'a, T: IncomingRequest> FromTransformedData<'a> for Ruma<T> {
}
}
impl<T> Deref for Ruma<T> {
impl<T: IncomingRequest> Deref for Ruma<T> {
type Target = T;
fn deref(&self) -> &Self::Target {