refactor: Ruma upstreaming, half-baked edition

Co-authored-by: Jade Ellis <jade@ellis.link>
This commit is contained in:
Ginger
2026-03-29 12:25:42 -04:00
parent 1cc9dbf2a4
commit 204bc1367e
141 changed files with 2715 additions and 2279 deletions
+5 -7
View File
@@ -7,9 +7,7 @@ use conduwuit::{
use database::{Deserialized, Ignore, Interfix, Json, Map};
use futures::StreamExt;
use ruma::{
OwnedRoomId, RoomId, UserId,
api::client::backup::{BackupAlgorithm, KeyBackupData, RoomKeyBackup},
serde::Raw,
OwnedRoomId, OwnedUserId, RoomId, UserId, api::client::backup::{BackupAlgorithm, KeyBackupData, RoomKeyBackup}, serde::Raw
};
use crate::{Dep, globals};
@@ -103,7 +101,7 @@ pub async fn update_backup<'a>(
#[implement(Service)]
pub async fn get_latest_backup_version(&self, user_id: &UserId) -> Result<String> {
type Key<'a> = (&'a UserId, &'a str);
type Key<'a> = (OwnedUserId, &'a str);
let last_possible_key = (user_id, u64::MAX);
self.db
@@ -122,7 +120,7 @@ pub async fn get_latest_backup(
&self,
user_id: &UserId,
) -> Result<(String, Raw<BackupAlgorithm>)> {
type Key<'a> = (&'a UserId, &'a str);
type Key<'a> = (OwnedUserId, &'a str);
type KeyVal<'a> = (Key<'a>, Raw<BackupAlgorithm>);
let last_possible_key = (user_id, u64::MAX);
@@ -197,11 +195,11 @@ pub async fn get_all(
user_id: &UserId,
version: &str,
) -> BTreeMap<OwnedRoomId, RoomKeyBackup> {
type Key<'a> = (Ignore, Ignore, &'a RoomId, &'a str);
type Key<'a> = (Ignore, Ignore, OwnedRoomId, &'a str);
type KeyVal<'a> = (Key<'a>, Raw<KeyBackupData>);
let mut rooms = BTreeMap::<OwnedRoomId, RoomKeyBackup>::new();
let default = || RoomKeyBackup { sessions: BTreeMap::new() };
let default = || RoomKeyBackup::new(BTreeMap::new());
let prefix = (user_id, version, Interfix);
self.db