Skip to content

Commit

Permalink
refactor: Move Event and Gap into matrix_sdk_base::event_cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Nov 13, 2024
1 parent c3e28f7 commit aca83fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
13 changes: 13 additions & 0 deletions crates/matrix-sdk-base/src/event_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
12 changes: 1 addition & 11 deletions crates/matrix-sdk/src/event_cache/room/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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.
Expand Down

0 comments on commit aca83fb

Please sign in to comment.