chore(sdk): Move SlidingSyncState into the sliding_sync::view module.

This commit is contained in:
Ivan Enderlin
2023-02-27 13:38:09 +01:00
parent 6cec946401
commit 49eee14665
2 changed files with 23 additions and 25 deletions

View File

@@ -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 {

View File

@@ -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,
}