mirror of https://gitlab.com/famedly/conduit
messing around with arcs
parent
face766e0f
commit
cff52d7ebb
@ -1,4 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{database::KeyValueDatabase, service};
|
||||
|
||||
impl service::rooms::short::Data for KeyValueDatabase {
|
||||
impl service::rooms::short::Data for Arc<KeyValueDatabase> {
|
||||
}
|
||||
|
@ -1,8 +1,30 @@
|
||||
use ruma::signatures::Ed25519KeyPair;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use ruma::{signatures::Ed25519KeyPair, DeviceId, UserId, ServerName, api::federation::discovery::{ServerSigningKeys, VerifyKey}, ServerSigningKeyId};
|
||||
|
||||
use crate::Result;
|
||||
|
||||
pub trait Data {
|
||||
#[async_trait]
|
||||
pub trait Data: Send + Sync {
|
||||
fn next_count(&self) -> Result<u64>;
|
||||
fn current_count(&self) -> Result<u64>;
|
||||
async fn watch(&self, user_id: &UserId, device_id: &DeviceId) -> Result<()>;
|
||||
fn cleanup(&self) -> Result<()>;
|
||||
fn memory_usage(&self) -> Result<String>;
|
||||
fn load_keypair(&self) -> Result<Ed25519KeyPair>;
|
||||
fn remove_keypair(&self) -> Result<()>;
|
||||
fn add_signing_key(
|
||||
&self,
|
||||
origin: &ServerName,
|
||||
new_keys: ServerSigningKeys,
|
||||
) -> Result<BTreeMap<Box<ServerSigningKeyId>, VerifyKey>>;
|
||||
|
||||
/// This returns an empty `Ok(BTreeMap<..>)` when there are no keys found for the server.
|
||||
fn signing_keys_for(
|
||||
&self,
|
||||
origin: &ServerName,
|
||||
) -> Result<BTreeMap<Box<ServerSigningKeyId>, VerifyKey>>;
|
||||
fn database_version(&self) -> Result<u64>;
|
||||
fn bump_database_version(&self, new_version: u64) -> Result<()>;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::collections::HashSet;
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
use crate::Result;
|
||||
|
||||
pub trait Data {
|
||||
fn get_cached_eventid_authchain(&self, shorteventid: u64) -> Result<Option<HashSet<u64>>>;
|
||||
fn cache_eventid_authchain(&self, shorteventid: u64, auth_chain: &HashSet<u64>) -> Result<()>;
|
||||
pub trait Data: Send + Sync {
|
||||
fn get_cached_eventid_authchain(&self, shorteventid: &[u64]) -> Result<Option<Arc<HashSet<u64>>>>;
|
||||
fn cache_auth_chain(&self, shorteventid: Vec<u64>, auth_chain: Arc<HashSet<u64>>) -> Result<()>;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use ruma::RoomId;
|
||||
use crate::Result;
|
||||
|
||||
pub trait Data {
|
||||
pub trait Data: Send + Sync {
|
||||
fn exists(&self, room_id: &RoomId) -> Result<bool>;
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
pub trait Data {
|
||||
pub trait Data: Send + Sync {
|
||||
}
|
||||
|
Loading…
Reference in New Issue