From 9c1bec3c0c493d6a172e2624ba952c96259ce786 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 11 Nov 2024 17:17:09 +0100 Subject: [PATCH] refactor: Move `Event` and `Gap` into `matrix_sdk_base::event_cache`. --- crates/matrix-sdk-base/src/event_cache/mod.rs | 13 +++++++++++++ crates/matrix-sdk/src/event_cache/room/events.rs | 12 +----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/crates/matrix-sdk-base/src/event_cache/mod.rs b/crates/matrix-sdk-base/src/event_cache/mod.rs index 70bd71760a6..0b4a80a4d95 100644 --- a/crates/matrix-sdk-base/src/event_cache/mod.rs +++ b/crates/matrix-sdk-base/src/event_cache/mod.rs @@ -14,4 +14,17 @@ //! Event cache store and common types shared with `matrix_sdk::event_cache`. +use matrix_sdk_common::deserialized_responses::SyncTimelineEvent; + pub mod store; + +/// The kind of event the event storage holds. +pub type Event = SyncTimelineEvent; + +/// The kind of gap the event storage holds. +#[derive(Clone, Debug)] +pub struct Gap { + /// The token to use in the query, extracted from a previous "from" / + /// "end" field of a `/messages` response. + pub prev_token: String, +} diff --git a/crates/matrix-sdk/src/event_cache/room/events.rs b/crates/matrix-sdk/src/event_cache/room/events.rs index 90d998923ed..d9168bdca63 100644 --- a/crates/matrix-sdk/src/event_cache/room/events.rs +++ b/crates/matrix-sdk/src/event_cache/room/events.rs @@ -14,7 +14,7 @@ use std::cmp::Ordering; -use matrix_sdk_common::deserialized_responses::SyncTimelineEvent; +pub use matrix_sdk_base::event_cache::{Event, Gap}; use matrix_sdk_common::linked_chunk::{ Chunk, ChunkIdentifier, EmptyChunk, Error, Iter, LinkedChunk, Position, }; @@ -23,16 +23,6 @@ use tracing::{debug, error, warn}; use super::super::deduplicator::{Decoration, Deduplicator}; -/// An alias for the real event type. -pub(crate) type Event = SyncTimelineEvent; - -#[derive(Clone, Debug)] -pub struct Gap { - /// The token to use in the query, extracted from a previous "from" / - /// "end" field of a `/messages` response. - pub prev_token: String, -} - const DEFAULT_CHUNK_CAPACITY: usize = 128; /// This type represents all events of a single room.