Add PduId wrapper struct

Death to Vec<u8>
This commit is contained in:
Lambda 2024-08-26 16:47:50 +00:00
parent 341f4213d0
commit 26322d5a95
15 changed files with 110 additions and 71 deletions

View file

@ -37,7 +37,7 @@ use serde_json::value::RawValue as RawJsonValue;
use tokio::sync::{RwLock, RwLockWriteGuard, Semaphore};
use tracing::{debug, error, info, trace, warn};
use super::state_compressor::CompressedStateEvent;
use super::{state_compressor::CompressedStateEvent, timeline::PduId};
use crate::{
service::{globals::SigningKeys, pdu},
services,
@ -89,7 +89,7 @@ impl Service {
value: CanonicalJsonObject,
is_timeline_event: bool,
pub_key_map: &'a RwLock<BTreeMap<String, SigningKeys>>,
) -> Result<Option<Vec<u8>>> {
) -> Result<Option<PduId>> {
// 0. Check the server is in the room
if !services().rooms.metadata.exists(room_id)? {
return Err(Error::BadRequest(
@ -565,7 +565,7 @@ impl Service {
origin: &ServerName,
room_id: &RoomId,
pub_key_map: &RwLock<BTreeMap<String, SigningKeys>>,
) -> Result<Option<Vec<u8>>> {
) -> Result<Option<PduId>> {
// Skip the PDU if we already have it as a timeline event
if let Ok(Some(pduid)) =
services().rooms.timeline.get_pdu_id(&incoming_pdu.event_id)