mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 00:31:24 +01:00
Add wrapper types for short IDs
This commit is contained in:
parent
f1642c92d1
commit
b0f33207fe
28 changed files with 427 additions and 232 deletions
|
|
@ -31,7 +31,7 @@ use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
|
|||
use tokio::sync::RwLock;
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
use super::state_compressor::CompressedStateEvent;
|
||||
use super::{short::ShortRoomId, state_compressor::CompressedStateEvent};
|
||||
use crate::{
|
||||
api::server_server,
|
||||
service::{
|
||||
|
|
@ -297,7 +297,7 @@ impl Service {
|
|||
.reset_notification_counts(&pdu.sender, &pdu.room_id)?;
|
||||
|
||||
let count2 = services().globals.next_count()?;
|
||||
let mut pdu_id = shortroomid.to_be_bytes().to_vec();
|
||||
let mut pdu_id = shortroomid.get().to_be_bytes().to_vec();
|
||||
pdu_id.extend_from_slice(&count2.to_be_bytes());
|
||||
let pdu_id = PduId::new(pdu_id);
|
||||
|
||||
|
|
@ -1194,7 +1194,7 @@ impl Service {
|
|||
&self,
|
||||
event_id: &EventId,
|
||||
reason: &PduEvent,
|
||||
shortroomid: u64,
|
||||
shortroomid: ShortRoomId,
|
||||
) -> Result<()> {
|
||||
// TODO: Don't reserialize, keep original json
|
||||
if let Some(pdu_id) = self.get_pdu_id(event_id)? {
|
||||
|
|
@ -1359,7 +1359,7 @@ impl Service {
|
|||
.await;
|
||||
|
||||
let count = services().globals.next_count()?;
|
||||
let mut pdu_id = shortroomid.to_be_bytes().to_vec();
|
||||
let mut pdu_id = shortroomid.get().to_be_bytes().to_vec();
|
||||
pdu_id.extend_from_slice(&0_u64.to_be_bytes());
|
||||
pdu_id.extend_from_slice(&(u64::MAX - count).to_be_bytes());
|
||||
let pdu_id = PduId::new(pdu_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue