mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 15:51:23 +01:00
add constructor for state compressor service
This commit is contained in:
parent
c6e2f8372c
commit
f702b6cccd
2 changed files with 15 additions and 5 deletions
|
|
@ -153,17 +153,17 @@ impl Services {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
state_cache: rooms::state_cache::Service::new(db),
|
state_cache: rooms::state_cache::Service::new(db),
|
||||||
state_compressor: rooms::state_compressor::Service {
|
state_compressor: rooms::state_compressor::Service::new(
|
||||||
db,
|
db,
|
||||||
#[allow(
|
#[allow(
|
||||||
clippy::as_conversions,
|
clippy::as_conversions,
|
||||||
clippy::cast_sign_loss,
|
clippy::cast_sign_loss,
|
||||||
clippy::cast_possible_truncation
|
clippy::cast_possible_truncation
|
||||||
)]
|
)]
|
||||||
stateinfo_cache: StdMutex::new(LruCache::new(
|
{
|
||||||
(100.0 * config.cache_capacity_modifier) as usize,
|
(100.0 * config.cache_capacity_modifier) as usize
|
||||||
)),
|
},
|
||||||
},
|
),
|
||||||
timeline: rooms::timeline::Service::new(
|
timeline: rooms::timeline::Service::new(
|
||||||
db,
|
db,
|
||||||
config.pdu_cache_capacity,
|
config.pdu_cache_capacity,
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,16 @@ impl CompressedStateEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Service {
|
impl Service {
|
||||||
|
pub(crate) fn new(
|
||||||
|
db: &'static dyn Data,
|
||||||
|
stateinfo_cache_size: usize,
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
db,
|
||||||
|
stateinfo_cache: Mutex::new(LruCache::new(stateinfo_cache_size)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns a stack with info on shortstatehash, full state, added diff and
|
/// Returns a stack with info on shortstatehash, full state, added diff and
|
||||||
/// removed diff for the selected shortstatehash and each parent layer.
|
/// removed diff for the selected shortstatehash and each parent layer.
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue