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

refactor(event cache): some preparatory refactorings #4316

Merged
merged 3 commits into from
Nov 25, 2024
Merged
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
6 changes: 3 additions & 3 deletions crates/matrix-sdk-base/src/event_cache/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub use self::{
#[derive(Clone)]
pub struct EventCacheStoreLock {
/// The inner cross process lock that is used to lock the `EventCacheStore`.
cross_process_lock: CrossProcessStoreLock<LockableEventCacheStore>,
cross_process_lock: Arc<CrossProcessStoreLock<LockableEventCacheStore>>,

/// The store itself.
///
Expand All @@ -70,11 +70,11 @@ impl EventCacheStoreLock {
let store = store.into_event_cache_store();

Self {
cross_process_lock: CrossProcessStoreLock::new(
cross_process_lock: Arc::new(CrossProcessStoreLock::new(
LockableEventCacheStore(store.clone()),
"default".to_owned(),
holder,
),
)),
store,
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/matrix-sdk-ui/src/timeline/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ pub enum Error {
UnknownEncryptionState,

/// Something went wrong with the room event cache.
#[error("Something went wrong with the room event cache.")]
#[error(transparent)]
EventCacheError(#[from] EventCacheError),

/// An error happened during pagination.
#[error("An error happened during pagination.")]
#[error(transparent)]
PaginationError(#[from] PaginationError),

/// An error happened during pagination.
#[error("An error happened when loading pinned events.")]
#[error(transparent)]
PinnedEventsError(#[from] PinnedEventsLoaderError),

/// An error happened while operating the room's send queue.
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub use http_client::TransmissionProgress;
#[cfg(all(feature = "e2e-encryption", feature = "sqlite"))]
pub use matrix_sdk_sqlite::SqliteCryptoStore;
#[cfg(feature = "sqlite")]
pub use matrix_sdk_sqlite::SqliteStateStore;
pub use matrix_sdk_sqlite::{SqliteEventCacheStore, SqliteStateStore};
pub use media::Media;
pub use pusher::Pusher;
pub use room::Room;
Expand Down
11 changes: 6 additions & 5 deletions labs/multiverse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use matrix_sdk::{
events::room::message::{MessageType, RoomMessageEventContent},
MilliSecondsSinceUnixEpoch, OwnedRoomId, RoomId,
},
AuthSession, Client, ServerName, SqliteCryptoStore, SqliteStateStore,
AuthSession, Client, ServerName, SqliteCryptoStore, SqliteEventCacheStore, SqliteStateStore,
};
use matrix_sdk_ui::{
room_list_service::{self, filters::new_filter_non_left},
Expand Down Expand Up @@ -949,10 +949,11 @@ async fn configure_client(server_name: String, config_path: String) -> anyhow::R
let mut client_builder = Client::builder()
.store_config(
StoreConfig::new("multiverse".to_owned())
.crypto_store(
SqliteCryptoStore::open(config_path.join("crypto.sqlite"), None).await?,
)
.state_store(SqliteStateStore::open(config_path.join("state.sqlite"), None).await?),
.crypto_store(SqliteCryptoStore::open(config_path.join("crypto"), None).await?)
.state_store(SqliteStateStore::open(config_path.join("state"), None).await?)
.event_cache_store(
SqliteEventCacheStore::open(config_path.join("cache"), None).await?,
),
)
.server_name(&server_name)
.with_encryption_settings(EncryptionSettings {
Expand Down
Loading