diff --git a/src/service/rooms/short/mod.rs b/src/service/rooms/short/mod.rs index 609c0e07..02c449cc 100644 --- a/src/service/rooms/short/mod.rs +++ b/src/service/rooms/short/mod.rs @@ -24,6 +24,10 @@ struct Services { globals: Dep, } +pub type ShortEventId = ShortId; +pub type ShortRoomId = ShortId; +pub type ShortId = u64; + impl crate::Service for Service { fn build(args: crate::Args<'_>) -> Result> { Ok(Arc::new(Self { diff --git a/src/service/rooms/timeline/mod.rs b/src/service/rooms/timeline/mod.rs index 902e50ff..e45bf7e5 100644 --- a/src/service/rooms/timeline/mod.rs +++ b/src/service/rooms/timeline/mod.rs @@ -1,4 +1,5 @@ mod data; +mod pduid; use std::{ cmp, @@ -38,7 +39,10 @@ use serde::Deserialize; use serde_json::value::{to_raw_value, RawValue as RawJsonValue}; use self::data::Data; -pub use self::data::PdusIterItem; +pub use self::{ + data::PdusIterItem, + pduid::{PduId, RawPduId}, +}; use crate::{ account_data, admin, appservice, appservice::NamespaceRegex, globals, pusher, rooms, rooms::state_compressor::CompressedStateEvent, sending, server_keys, users, Dep, diff --git a/src/service/rooms/timeline/pduid.rs b/src/service/rooms/timeline/pduid.rs new file mode 100644 index 00000000..b43c382c --- /dev/null +++ b/src/service/rooms/timeline/pduid.rs @@ -0,0 +1,13 @@ +use crate::rooms::short::{ShortEventId, ShortRoomId}; + +#[derive(Clone, Copy)] +pub struct PduId { + _room_id: ShortRoomId, + _event_id: ShortEventId, +} + +pub type RawPduId = [u8; PduId::LEN]; + +impl PduId { + pub const LEN: usize = size_of::() + size_of::(); +}