feat: swappable database backend
This commit is contained in:
parent
81715bd84d
commit
d0ee823254
47 changed files with 1434 additions and 981 deletions
|
@ -14,7 +14,10 @@ use ruma::{
|
|||
encryption::UnsignedDeviceInfo,
|
||||
DeviceId, DeviceKeyAlgorithm, UserId,
|
||||
};
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::{
|
||||
collections::{BTreeMap, HashSet},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
#[cfg(feature = "conduit_bin")]
|
||||
use rocket::{get, post};
|
||||
|
@ -25,7 +28,7 @@ use rocket::{get, post};
|
|||
)]
|
||||
#[tracing::instrument(skip(db, body))]
|
||||
pub async fn upload_keys_route(
|
||||
db: State<'_, Database>,
|
||||
db: State<'_, Arc<Database>>,
|
||||
body: Ruma<upload_keys::Request>,
|
||||
) -> ConduitResult<upload_keys::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
@ -74,7 +77,7 @@ pub async fn upload_keys_route(
|
|||
)]
|
||||
#[tracing::instrument(skip(db, body))]
|
||||
pub async fn get_keys_route(
|
||||
db: State<'_, Database>,
|
||||
db: State<'_, Arc<Database>>,
|
||||
body: Ruma<get_keys::Request<'_>>,
|
||||
) -> ConduitResult<get_keys::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
@ -95,7 +98,7 @@ pub async fn get_keys_route(
|
|||
)]
|
||||
#[tracing::instrument(skip(db, body))]
|
||||
pub async fn claim_keys_route(
|
||||
db: State<'_, Database>,
|
||||
db: State<'_, Arc<Database>>,
|
||||
body: Ruma<claim_keys::Request>,
|
||||
) -> ConduitResult<claim_keys::Response> {
|
||||
let response = claim_keys_helper(&body.one_time_keys, &db)?;
|
||||
|
@ -111,7 +114,7 @@ pub async fn claim_keys_route(
|
|||
)]
|
||||
#[tracing::instrument(skip(db, body))]
|
||||
pub async fn upload_signing_keys_route(
|
||||
db: State<'_, Database>,
|
||||
db: State<'_, Arc<Database>>,
|
||||
body: Ruma<upload_signing_keys::Request<'_>>,
|
||||
) -> ConduitResult<upload_signing_keys::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
@ -174,7 +177,7 @@ pub async fn upload_signing_keys_route(
|
|||
)]
|
||||
#[tracing::instrument(skip(db, body))]
|
||||
pub async fn upload_signatures_route(
|
||||
db: State<'_, Database>,
|
||||
db: State<'_, Arc<Database>>,
|
||||
body: Ruma<upload_signatures::Request>,
|
||||
) -> ConduitResult<upload_signatures::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
@ -235,7 +238,7 @@ pub async fn upload_signatures_route(
|
|||
)]
|
||||
#[tracing::instrument(skip(db, body))]
|
||||
pub async fn get_key_changes_route(
|
||||
db: State<'_, Database>,
|
||||
db: State<'_, Arc<Database>>,
|
||||
body: Ruma<get_key_changes::Request<'_>>,
|
||||
) -> ConduitResult<get_key_changes::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue