refactor for stronger RawPduId type
implement standard traits for PduCount enable serde for arrayvec typedef various shortid's pducount simplifications split parts of pdu_metadata service to core/pdu and api/relations remove some yields; improve var names/syntax tweak types for limit timeline limit arguments Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
2e4d9cb37c
commit
9da523c004
41 changed files with 796 additions and 573 deletions
|
@ -35,7 +35,10 @@ use ruma::{
|
|||
|
||||
use crate::{
|
||||
globals, rooms,
|
||||
rooms::state_compressor::{CompressedStateEvent, HashSetCompressStateEvent},
|
||||
rooms::{
|
||||
state_compressor::{CompressedStateEvent, HashSetCompressStateEvent},
|
||||
timeline::RawPduId,
|
||||
},
|
||||
sending, server_keys, Dep,
|
||||
};
|
||||
|
||||
|
@ -136,10 +139,10 @@ impl Service {
|
|||
pub async fn handle_incoming_pdu<'a>(
|
||||
&self, origin: &'a ServerName, room_id: &'a RoomId, event_id: &'a EventId,
|
||||
value: BTreeMap<String, CanonicalJsonValue>, is_timeline_event: bool,
|
||||
) -> Result<Option<Vec<u8>>> {
|
||||
) -> Result<Option<RawPduId>> {
|
||||
// 1. Skip the PDU if we already have it as a timeline event
|
||||
if let Ok(pdu_id) = self.services.timeline.get_pdu_id(event_id).await {
|
||||
return Ok(Some(pdu_id.to_vec()));
|
||||
return Ok(Some(pdu_id));
|
||||
}
|
||||
|
||||
// 1.1 Check the server is in the room
|
||||
|
@ -488,7 +491,7 @@ impl Service {
|
|||
pub async fn upgrade_outlier_to_timeline_pdu(
|
||||
&self, incoming_pdu: Arc<PduEvent>, val: BTreeMap<String, CanonicalJsonValue>, create_event: &PduEvent,
|
||||
origin: &ServerName, room_id: &RoomId,
|
||||
) -> Result<Option<Vec<u8>>> {
|
||||
) -> Result<Option<RawPduId>> {
|
||||
// Skip the PDU if we already have it as a timeline event
|
||||
if let Ok(pduid) = self
|
||||
.services
|
||||
|
@ -496,7 +499,7 @@ impl Service {
|
|||
.get_pdu_id(&incoming_pdu.event_id)
|
||||
.await
|
||||
{
|
||||
return Ok(Some(pduid.to_vec()));
|
||||
return Ok(Some(pduid));
|
||||
}
|
||||
|
||||
if self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue