Skip to content

Commit b3b61fe

Browse files
committed
base: Add media retention policy to EventCacheStore
Signed-off-by: Kévin Commaille <[email protected]>
1 parent 06fc220 commit b3b61fe

File tree

9 files changed

+1192
-105
lines changed

9 files changed

+1192
-105
lines changed

crates/matrix-sdk-base/src/client.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515

16-
#[cfg(feature = "e2e-encryption")]
17-
use std::ops::Deref;
1816
use std::{
1917
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
2018
fmt, iter,
21-
sync::Arc,
2219
};
20+
#[cfg(feature = "e2e-encryption")]
21+
use std::{ops::Deref, sync::Arc};
2322

2423
use eyeball::{SharedObservable, Subscriber};
2524
#[cfg(not(target_arch = "wasm32"))]
@@ -71,7 +70,7 @@ use crate::RoomMemberships;
7170
use crate::{
7271
deserialized_responses::{RawAnySyncOrStrippedTimelineEvent, SyncTimelineEvent},
7372
error::{Error, Result},
74-
event_cache_store::DynEventCacheStore,
73+
event_cache_store::EventCacheStoreWrapper,
7574
rooms::{
7675
normal::{RoomInfoNotableUpdate, RoomInfoNotableUpdateReasons},
7776
Room, RoomInfo, RoomState,
@@ -93,7 +92,7 @@ pub struct BaseClient {
9392
/// Database
9493
pub(crate) store: Store,
9594
/// The store used by the event cache.
96-
event_cache_store: Arc<DynEventCacheStore>,
95+
event_cache_store: EventCacheStoreWrapper,
9796
/// The store used for encryption.
9897
///
9998
/// This field is only meant to be used for `OlmMachine` initialization.
@@ -147,7 +146,7 @@ impl BaseClient {
147146

148147
BaseClient {
149148
store: Store::new(config.state_store),
150-
event_cache_store: config.event_cache_store,
149+
event_cache_store: EventCacheStoreWrapper::new(config.event_cache_store),
151150
#[cfg(feature = "e2e-encryption")]
152151
crypto_store: config.crypto_store,
153152
#[cfg(feature = "e2e-encryption")]
@@ -222,8 +221,8 @@ impl BaseClient {
222221
}
223222

224223
/// Get a reference to the event cache store.
225-
pub fn event_cache_store(&self) -> &DynEventCacheStore {
226-
&*self.event_cache_store
224+
pub fn event_cache_store(&self) -> &EventCacheStoreWrapper {
225+
&self.event_cache_store
227226
}
228227

229228
/// Is the client logged in.

0 commit comments

Comments
 (0)