devirtualize service Data traits
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
a6edaad6fc
commit
7ad7badd60
64 changed files with 1190 additions and 1176 deletions
|
@ -1,8 +1,11 @@
|
|||
use std::{
|
||||
fmt::{Display, Formatter},
|
||||
str::FromStr,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use conduit::Server;
|
||||
use database::KeyValueDatabase;
|
||||
use lru_cache::LruCache;
|
||||
use ruma::{
|
||||
api::{
|
||||
|
@ -330,6 +333,16 @@ impl From<CachedSpaceHierarchySummary> for SpaceHierarchyRoomsChunk {
|
|||
}
|
||||
|
||||
impl Service {
|
||||
pub fn build(server: &Arc<Server>, _db: &Arc<KeyValueDatabase>) -> Result<Self> {
|
||||
let config = &server.config;
|
||||
Ok(Self {
|
||||
roomid_spacehierarchy_cache: Mutex::new(LruCache::new(
|
||||
(f64::from(config.roomid_spacehierarchy_cache_capacity) * config.conduit_cache_capacity_modifier)
|
||||
as usize,
|
||||
)),
|
||||
})
|
||||
}
|
||||
|
||||
///Gets the response for the space hierarchy over federation request
|
||||
///
|
||||
///Panics if the room does not exist, so a check if the room exists should
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue