refactor dyn KvTree out of services
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
use std::{mem::size_of, sync::Arc};
|
||||
|
||||
use database::KvTree;
|
||||
|
||||
use crate::{utils, KeyValueDatabase, Result};
|
||||
use conduit::{utils, Result};
|
||||
use database::{Database, Map};
|
||||
|
||||
pub(super) struct Data {
|
||||
shorteventid_authchain: Arc<dyn KvTree>,
|
||||
db: Arc<KeyValueDatabase>,
|
||||
shorteventid_authchain: Arc<Map>,
|
||||
db: Arc<Database>,
|
||||
}
|
||||
|
||||
impl Data {
|
||||
pub(super) fn new(db: &Arc<KeyValueDatabase>) -> Self {
|
||||
pub(super) fn new(db: &Arc<Database>) -> Self {
|
||||
Self {
|
||||
shorteventid_authchain: db.shorteventid_authchain.clone(),
|
||||
shorteventid_authchain: db["shorteventid_authchain"].clone(),
|
||||
db: db.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
use conduit::Server;
|
||||
use database::KeyValueDatabase;
|
||||
|
||||
mod data;
|
||||
|
||||
use std::{
|
||||
collections::{BTreeSet, HashSet},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use conduit::{debug, error, trace, warn, Error, Result, Server};
|
||||
use data::Data;
|
||||
use database::Database;
|
||||
use ruma::{api::client::error::ErrorKind, EventId, RoomId};
|
||||
use tracing::{debug, error, trace, warn};
|
||||
|
||||
use crate::{services, Error, Result};
|
||||
use crate::services;
|
||||
|
||||
pub struct Service {
|
||||
db: Data,
|
||||
}
|
||||
|
||||
impl Service {
|
||||
pub fn build(_server: &Arc<Server>, db: &Arc<KeyValueDatabase>) -> Result<Self> {
|
||||
pub fn build(_server: &Arc<Server>, db: &Arc<Database>) -> Result<Self> {
|
||||
Ok(Self {
|
||||
db: Data::new(db),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user