conduwuit/src/service/rooms/edus/read_receipt/data.rs

37 lines
1.1 KiB
Rust
Raw Normal View History

2022-09-07 13:25:51 +02:00
use crate::Result;
2022-10-05 20:34:31 +02:00
use ruma::{events::receipt::ReceiptEvent, serde::Raw, RoomId, UserId};
2022-10-05 15:33:57 +02:00
pub trait Data: Send + Sync {
/// 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`.
2022-10-08 13:02:52 +02:00
fn readreceipts_since<'a>(
&'a self,
room_id: &RoomId,
since: u64,
2022-10-05 20:34:31 +02:00
) -> Box<
dyn Iterator<
Item = Result<(
Box<UserId>,
u64,
Raw<ruma::events::AnySyncEphemeralRoomEvent>,
)>,
2022-10-08 13:02:52 +02:00
> + 'a,
2022-10-05 20:34:31 +02:00
>;
/// Sets a private read marker at `count`.
fn private_read_set(&self, room_id: &RoomId, user_id: &UserId, count: u64) -> Result<()>;
/// Returns the private read marker.
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.
fn last_privateread_update(&self, user_id: &UserId, room_id: &RoomId) -> Result<u64>;
}