Skip to main content

SyncQueries

Trait SyncQueries 

Source
pub trait SyncQueries: Database {
    // Provided methods
    async fn fetch_new_room_membership_event(
        &mut self,
        room_id: &RoomId,
        user_id: &UserId,
        from_stream_id: StreamId,
    ) -> Result<Option<RoomEvent<Verified>>, DatabaseError> { ... }
    async fn fetch_sync_room_events(
        &mut self,
        user: &UserId,
        from_stream_id: StreamId,
        room_filters: Option<&RoomFilter>,
    ) -> Result<Vec<SyncEvent>, DatabaseError> { ... }
    async fn fetch_room_messages_forwards(
        &mut self,
        user: &UserId,
        room: &RoomId,
        from_event_id: Option<&EventId>,
        limit: UInt,
        room_filters: &RoomEventFilter,
    ) -> Result<(Vec<RoomEvent<Verified>>, bool), DatabaseError> { ... }
    async fn fetch_room_messages_backwards(
        &mut self,
        user: &UserId,
        room: &RoomId,
        from_event_id: Option<&EventId>,
        limit: UInt,
        room_filters: &RoomEventFilter,
    ) -> Result<(Vec<RoomEvent<Verified>>, bool), DatabaseError> { ... }
    async fn fetch_incremental_room_state_for_user(
        &mut self,
        room_id: &RoomId,
        from_event_id: StreamId,
        to_stream_id: StreamId,
    ) -> Result<Vec<RoomEvent<Verified>>, DatabaseError> { ... }
}
Expand description

Queries related to sync

Provided Methods§

Source

async fn fetch_new_room_membership_event( &mut self, room_id: &RoomId, user_id: &UserId, from_stream_id: StreamId, ) -> Result<Option<RoomEvent<Verified>>, DatabaseError>

Fetches the earliest membership event for a user in a room, since from_stream_id

Source

async fn fetch_sync_room_events( &mut self, user: &UserId, from_stream_id: StreamId, room_filters: Option<&RoomFilter>, ) -> Result<Vec<SyncEvent>, DatabaseError>

Fetches all room events the user is able to see, starting at from_stream_id.

Source

async fn fetch_room_messages_forwards( &mut self, user: &UserId, room: &RoomId, from_event_id: Option<&EventId>, limit: UInt, room_filters: &RoomEventFilter, ) -> Result<(Vec<RoomEvent<Verified>>, bool), DatabaseError>

Fetch messages forwards starting from the given event ID. If no event ID is given, the starting point is the earliest event visible to the given user.

The returned boolean is true if there are more than limit messages.

Source

async fn fetch_room_messages_backwards( &mut self, user: &UserId, room: &RoomId, from_event_id: Option<&EventId>, limit: UInt, room_filters: &RoomEventFilter, ) -> Result<(Vec<RoomEvent<Verified>>, bool), DatabaseError>

Fetch messages backwards starting from the given event ID. If no event ID is given, the starting point is the last event visible to the given user.

The returned boolean is true if there are more than limit messages.

Source

async fn fetch_incremental_room_state_for_user( &mut self, room_id: &RoomId, from_event_id: StreamId, to_stream_id: StreamId, ) -> Result<Vec<RoomEvent<Verified>>, DatabaseError>

Get all state changes between two points in the timeline

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> SyncQueries for T
where T: Database,

Make the query available on types implementing the Database trait.