mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 08:41:24 +01:00
Add PduId wrapper struct
Death to Vec<u8>
This commit is contained in:
parent
341f4213d0
commit
26322d5a95
15 changed files with 110 additions and 71 deletions
|
|
@ -4,6 +4,7 @@ use crate::{
|
|||
database::KeyValueDatabase,
|
||||
service::{
|
||||
self,
|
||||
rooms::timeline::PduId,
|
||||
sending::{Destination, RequestKey, SendingEventType},
|
||||
},
|
||||
services, utils, Error, Result,
|
||||
|
|
@ -61,7 +62,7 @@ impl service::sending::Data for KeyValueDatabase {
|
|||
for (destination, event) in requests {
|
||||
let mut key = destination.get_prefix();
|
||||
if let SendingEventType::Pdu(value) = &event {
|
||||
key.extend_from_slice(value);
|
||||
key.extend_from_slice(value.as_bytes());
|
||||
} else {
|
||||
key.extend_from_slice(
|
||||
&services().globals.next_count()?.to_be_bytes(),
|
||||
|
|
@ -202,7 +203,7 @@ fn parse_servercurrentevent(
|
|||
Ok((
|
||||
destination,
|
||||
if value.is_empty() {
|
||||
SendingEventType::Pdu(event.to_vec())
|
||||
SendingEventType::Pdu(PduId::new(event.to_vec()))
|
||||
} else {
|
||||
SendingEventType::Edu(value)
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue