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 11, 2024
1 parent 636b744 commit d1808ee
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,5 +14,18 @@

//! Common types for the event cache.
use matrix_sdk_common::deserialized_responses::SyncTimelineEvent;

pub mod linked_chunk;
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 ruma::OwnedEventId;
use tracing::{debug, error, warn};

Expand All @@ -23,16 +23,6 @@ use super::super::{
linked_chunk::{Chunk, ChunkIdentifier, EmptyChunk, Error, Iter, LinkedChunk, Position},
};

/// 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 d1808ee

Please sign in to comment.