refactor dyn KvTree out of services

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-28 22:51:39 +00:00
parent 57acc4f655
commit cb48e25783
69 changed files with 594 additions and 647 deletions

View file

@ -1,23 +1,22 @@
use std::{collections::HashSet, sync::Arc};
use conduit::utils::mutex_map;
use database::KvTree;
use conduit::{utils, Error, Result};
use database::{Database, Map};
use ruma::{EventId, OwnedEventId, RoomId};
use utils::mutex_map;
use crate::{utils, Error, KeyValueDatabase, Result};
pub struct Data {
shorteventid_shortstatehash: Arc<dyn KvTree>,
roomid_pduleaves: Arc<dyn KvTree>,
roomid_shortstatehash: Arc<dyn KvTree>,
pub(super) struct Data {
shorteventid_shortstatehash: Arc<Map>,
roomid_pduleaves: Arc<Map>,
roomid_shortstatehash: Arc<Map>,
}
impl Data {
pub(super) fn new(db: &Arc<KeyValueDatabase>) -> Self {
pub(super) fn new(db: &Arc<Database>) -> Self {
Self {
shorteventid_shortstatehash: db.shorteventid_shortstatehash.clone(),
roomid_pduleaves: db.roomid_pduleaves.clone(),
roomid_shortstatehash: db.roomid_shortstatehash.clone(),
shorteventid_shortstatehash: db["shorteventid_shortstatehash"].clone(),
roomid_pduleaves: db["roomid_pduleaves"].clone(),
roomid_shortstatehash: db["roomid_shortstatehash"].clone(),
}
}