mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
refactor: Ruma upstreaming, half-baked edition
Co-authored-by: Jade Ellis <jade@ellis.link>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user