Skip to main content

RoomKeysQueries

Trait RoomKeysQueries 

Source
pub trait RoomKeysQueries: Database {
    // Provided methods
    async fn insert_backup(
        &mut self,
        user_id: &UserId,
        auth_data: &Value,
    ) -> Result<String, DatabaseError> { ... }
    async fn update_user_backup(
        &mut self,
        user_id: &UserId,
        version: i64,
        new_auth_data: &Value,
    ) -> Result<(), DatabaseError> { ... }
    async fn fetch_max_user_backup_version(
        &mut self,
        user_id: &UserId,
    ) -> Result<i64, DatabaseError> { ... }
    async fn delete_user_backup(
        &mut self,
        user_id: &UserId,
        version: i64,
    ) -> Result<(), DatabaseError> { ... }
    async fn delete_backup_keys(
        &mut self,
        user_id: &UserId,
        version: i64,
        room_id: Option<OwnedRoomId>,
        session_id: Option<String>,
    ) -> Result<Option<(i64, u64)>, DatabaseError> { ... }
}
Expand description

Queries related to room keys tables.

Provided Methods§

Source

async fn insert_backup( &mut self, user_id: &UserId, auth_data: &Value, ) -> Result<String, DatabaseError>

Creates a new room keys backup in the database and return its version as a string.

Note that the version will be set to 1 by default.

Source

async fn update_user_backup( &mut self, user_id: &UserId, version: i64, new_auth_data: &Value, ) -> Result<(), DatabaseError>

Updates a specific user’s backup version.

Errors if the specified backup does not exist.

Source

async fn fetch_max_user_backup_version( &mut self, user_id: &UserId, ) -> Result<i64, DatabaseError>

Fetches the keys_backup_seq of an user. This value is the highest room keys backup version ever created for that user.

Source

async fn delete_user_backup( &mut self, user_id: &UserId, version: i64, ) -> Result<(), DatabaseError>

Deletes a specific user’s backup version.

Source

async fn delete_backup_keys( &mut self, user_id: &UserId, version: i64, room_id: Option<OwnedRoomId>, session_id: Option<String>, ) -> Result<Option<(i64, u64)>, DatabaseError>

Deletes room_keys entries belonging to the given user and backup version.

If room_id and session_id are Some, the query will use them as filters.

This returns the new etag for the backup, as well as the count of keys left in it.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§