2023-11-29 21:36:02 -05:00
|
|
|
use ruma::{
|
|
|
|
|
events::{receipt::ReceiptEvent, AnySyncEphemeralRoomEvent},
|
|
|
|
|
serde::Raw,
|
|
|
|
|
OwnedUserId, RoomId, UserId,
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-07 13:25:51 +02:00
|
|
|
use crate::Result;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2023-11-29 21:36:02 -05:00
|
|
|
type AnySyncEphemeralRoomEventIter<'a> =
|
|
|
|
|
Box<dyn Iterator<Item = Result<(OwnedUserId, u64, Raw<AnySyncEphemeralRoomEvent>)>> + 'a>;
|
2022-09-06 23:15:09 +02:00
|
|
|
|
2024-05-09 15:59:08 -07:00
|
|
|
pub trait Data: Send + Sync {
|
2022-06-25 16:12:23 +02:00
|
|
|
/// Replaces the previous read receipt.
|
|
|
|
|
fn readreceipt_update(&self, user_id: &UserId, room_id: &RoomId, event: ReceiptEvent) -> Result<()>;
|
|
|
|
|
|
|
|
|
|
/// Returns an iterator over the most recent read_receipts in a room that
|
|
|
|
|
/// happened after the event with id `since`.
|
2023-11-29 21:36:02 -05:00
|
|
|
fn readreceipts_since(&self, room_id: &RoomId, since: u64) -> AnySyncEphemeralRoomEventIter<'_>;
|
2022-06-25 16:12:23 +02:00
|
|
|
|
|
|
|
|
/// Sets a private read marker at `count`.
|
2022-07-10 14:37:34 +02:00
|
|
|
fn private_read_set(&self, room_id: &RoomId, user_id: &UserId, count: u64) -> Result<()>;
|
2022-06-25 16:12:23 +02:00
|
|
|
|
|
|
|
|
/// Returns the private read marker.
|
2024-04-22 23:54:56 -04:00
|
|
|
///
|
|
|
|
|
/// TODO: use this?
|
|
|
|
|
#[allow(dead_code)]
|
2022-06-25 16:12:23 +02:00
|
|
|
fn private_read_get(&self, room_id: &RoomId, user_id: &UserId) -> Result<Option<u64>>;
|
|
|
|
|
|
|
|
|
|
/// Returns the count of the last typing update in this room.
|
2024-04-22 23:54:56 -04:00
|
|
|
///
|
|
|
|
|
/// TODO: use this?
|
|
|
|
|
#[allow(dead_code)]
|
2022-06-25 16:12:23 +02:00
|
|
|
fn last_privateread_update(&self, user_id: &UserId, room_id: &RoomId) -> Result<u64>;
|
|
|
|
|
}
|