From 49eee146658f3f9fffdea8368b81b88bbdbc930d Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 27 Feb 2023 13:38:09 +0100 Subject: [PATCH] chore(sdk): Move `SlidingSyncState` into the `sliding_sync::view` module. --- crates/matrix-sdk/src/sliding_sync/mod.rs | 22 ------------------ crates/matrix-sdk/src/sliding_sync/view.rs | 26 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/crates/matrix-sdk/src/sliding_sync/mod.rs b/crates/matrix-sdk/src/sliding_sync/mod.rs index 1d7b2f312..d26526d00 100644 --- a/crates/matrix-sdk/src/sliding_sync/mod.rs +++ b/crates/matrix-sdk/src/sliding_sync/mod.rs @@ -665,28 +665,6 @@ pub enum Error { BuildMissingField(&'static str), } -/// The state the [`SlidingSyncView`] is in. -/// -/// The lifetime of a SlidingSync usually starts at a `Preload`, getting a fast -/// response for the first given number of Rooms, then switches into -/// `CatchingUp` during which the view fetches the remaining rooms, usually in -/// order, some times in batches. Once that is ready, it switches into `Live`. -/// -/// If the client has been offline for a while, though, the SlidingSync might -/// return back to `CatchingUp` at any point. -#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum SlidingSyncState { - /// Hasn't started yet - #[default] - Cold, - /// We are quickly preloading a preview of the most important rooms - Preload, - /// We are trying to load all remaining rooms, might be in batches - CatchingUp, - /// We are all caught up and now only sync the live responses. - Live, -} - /// The mode by which the the [`SlidingSyncView`] is in fetching the data. #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum SlidingSyncMode { diff --git a/crates/matrix-sdk/src/sliding_sync/view.rs b/crates/matrix-sdk/src/sliding_sync/view.rs index 5caafdffc..3426193a5 100644 --- a/crates/matrix-sdk/src/sliding_sync/view.rs +++ b/crates/matrix-sdk/src/sliding_sync/view.rs @@ -18,9 +18,7 @@ use ruma::{ use serde::{Deserialize, Serialize}; use tracing::{debug, error, instrument, trace, warn}; -use super::{ - Error, FrozenSlidingSyncRoom, RoomListEntry, SlidingSyncMode, SlidingSyncRoom, SlidingSyncState, -}; +use super::{Error, FrozenSlidingSyncRoom, RoomListEntry, SlidingSyncMode, SlidingSyncRoom}; use crate::Result; /// Holding a specific filtered view within the concept of sliding sync. @@ -906,3 +904,25 @@ fn room_ops( Ok(()) } + +/// The state the [`SlidingSyncView`] is in. +/// +/// The lifetime of a SlidingSync usually starts at a `Preload`, getting a fast +/// response for the first given number of Rooms, then switches into +/// `CatchingUp` during which the view fetches the remaining rooms, usually in +/// order, some times in batches. Once that is ready, it switches into `Live`. +/// +/// If the client has been offline for a while, though, the SlidingSync might +/// return back to `CatchingUp` at any point. +#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub enum SlidingSyncState { + /// Hasn't started yet + #[default] + Cold, + /// We are quickly preloading a preview of the most important rooms + Preload, + /// We are trying to load all remaining rooms, might be in batches + CatchingUp, + /// We are all caught up and now only sync the live responses. + Live, +}