Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base: Add media retention policy to EventCacheStore #3918

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions crates/matrix-sdk-base/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(feature = "e2e-encryption")]
use std::ops::Deref;
use std::{
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
fmt, iter,
sync::Arc,
};
#[cfg(feature = "e2e-encryption")]
use std::{ops::Deref, sync::Arc};

use eyeball::{SharedObservable, Subscriber};
#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -71,7 +70,7 @@ use crate::RoomMemberships;
use crate::{
deserialized_responses::{RawAnySyncOrStrippedTimelineEvent, SyncTimelineEvent},
error::{Error, Result},
event_cache_store::DynEventCacheStore,
event_cache_store::EventCacheStoreWrapper,
rooms::{
normal::{RoomInfoNotableUpdate, RoomInfoNotableUpdateReasons},
Room, RoomInfo, RoomState,
Expand All @@ -93,7 +92,7 @@ pub struct BaseClient {
/// Database
pub(crate) store: Store,
/// The store used by the event cache.
event_cache_store: Arc<DynEventCacheStore>,
event_cache_store: EventCacheStoreWrapper,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now an EventCacheStoreLock:

/// The high-level public type to represent an `EventCacheStore` lock.
#[derive(Clone)]
pub struct EventCacheStoreLock {
/// The inner cross process lock that is used to lock the `EventCacheStore`.
cross_process_lock: CrossProcessStoreLock<LockableEventCacheStore>,
/// The store itself.
///
/// That's the only place where the store exists.
store: Arc<DynEventCacheStore>,
}

which is a cross-process lock.

/// The store used for encryption.
///
/// This field is only meant to be used for `OlmMachine` initialization.
Expand Down Expand Up @@ -147,7 +146,7 @@ impl BaseClient {

BaseClient {
store: Store::new(config.state_store),
event_cache_store: config.event_cache_store,
event_cache_store: EventCacheStoreWrapper::new(config.event_cache_store),
#[cfg(feature = "e2e-encryption")]
crypto_store: config.crypto_store,
#[cfg(feature = "e2e-encryption")]
Expand Down Expand Up @@ -222,8 +221,8 @@ impl BaseClient {
}

/// Get a reference to the event cache store.
pub fn event_cache_store(&self) -> &DynEventCacheStore {
&*self.event_cache_store
pub fn event_cache_store(&self) -> &EventCacheStoreWrapper {
&self.event_cache_store
}

/// Is the client logged in.
Expand Down
Loading
Loading