move pdu_cache to service

This commit is contained in:
Charles Hall 2024-09-30 20:37:50 -07:00
parent fb534d8140
commit 7563360bee
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
6 changed files with 44 additions and 40 deletions

View file

@ -27,7 +27,7 @@ use crate::{
timeline::PduCount,
},
},
services, utils, Config, Error, PduEvent, Result,
services, utils, Config, Error, Result,
};
pub(crate) mod abstraction;
@ -236,7 +236,6 @@ pub(crate) struct KeyValueDatabase {
pub(super) senderkey_pusher: Arc<dyn KvTree>,
// Uncategorized trees
pub(super) pdu_cache: Mutex<LruCache<OwnedEventId, Arc<PduEvent>>>,
pub(super) shorteventid_cache: Mutex<LruCache<ShortEventId, Arc<EventId>>>,
pub(super) auth_chain_cache:
Mutex<LruCache<Vec<ShortEventId>, Arc<HashSet<ShortEventId>>>>,
@ -468,12 +467,6 @@ impl KeyValueDatabase {
global: builder.open_tree("global")?,
server_signingkeys: builder.open_tree("server_signingkeys")?,
pdu_cache: Mutex::new(LruCache::new(
config
.pdu_cache_capacity
.try_into()
.expect("pdu cache capacity fits into usize"),
)),
#[allow(
clippy::as_conversions,
clippy::cast_sign_loss,