Skip to main content

InboxMessage

Struct InboxMessage 

Source
pub struct InboxMessage {
    pub conversation_id: ConversationId,
    pub message: Vec<u8>,
    pub content_type: ContentType,
    pub waiting_for: WaitingFor,
    pub epoch: u64,
    pub arrival_sequence: u64,
}
Expand description

An MLS message waiting in the inbox until it can be processed.

Fields§

§conversation_id: ConversationId

Conversation for which this message is intended.

§message: Vec<u8>

Encrypted message data.

§content_type: ContentType

What kind of message this is.

§waiting_for: WaitingFor

What event this message is waiting for.

§epoch: u64

Epoch of this message.

§arrival_sequence: u64

An arbitrary monotonically increasing integer.

See crate::Transaction::inbox_message_next_arrival_sequence.

Implementations§

Source§

impl InboxMessage

Source

pub fn take<'a, Tx>( tx: &'a Tx, conversation_id: &ConversationIdRef, waiting_for: WaitingFor, epoch: Option<u64>, ) -> CryptoKeystoreResult<Vec<Self>>

Take items out of the inbox according to the provided parameters.

This removes items from the table. The intent is that cases where we don’t actually want to remove items from the table produce rollbacks, restoring these without hassle.

It is expected that taking messages waiting for a pending join will usually not set an epoch. This is not enforced in any way.

Results are returned ordered first by content_type, then by arrival_sequence.

Source

pub fn drop_stale<'a, Tx>( tx: &'a Tx, conversation_id: &ConversationIdRef, new_epoch: u64, ) -> CryptoKeystoreResult<usize>

Drop items from the inbox if they have gone stale.

This removes all items from the table which have an epoch older than new_epoch, except for those waiting for a pending join, returning the number of items dropped.

Trait Implementations§

Source§

impl BorrowPrimaryKey for InboxMessage

Source§

type BorrowedPrimaryKey<'a> = InboxMessagePkRef<'a> where Self: 'a

Source§

fn borrow_primary_key(&self) -> Self::BorrowedPrimaryKey<'_>

Borrow this entity’s primary key without copying any data. Read more
Source§

impl Clone for InboxMessage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InboxMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DeletableBySearchKey<ConversationIdRef> for InboxMessage

Source§

fn delete_all_matching<'a, Tx>( tx: &'a Tx, search_key: &ConversationIdRef, ) -> CryptoKeystoreResult<()>

Delete all entities matching the search key. Read more
Source§

impl Entity for InboxMessage

Source§

const TABLE_NAME: &str = Self::TABLE

The name of the SQL table for this entity
Source§

fn get( conn: &Connection, key: &Self::PrimaryKey, ) -> CryptoKeystoreResult<Option<Self>>

Get an entity by its primary key. Read more
Source§

fn count(conn: &Connection) -> CryptoKeystoreResult<u32>

Count the number of entities of this type in the database.
Source§

fn load_all(conn: &Connection) -> CryptoKeystoreResult<Vec<Self>>

Retrieve all entities of this type from the database.
Source§

impl EntityDatabaseMutation for InboxMessage

Source§

fn save<'a, Tx>(&self, tx: &'a Tx) -> CryptoKeystoreResult<()>

Duplicate save is a silent noop. Other conflicts return errors.

Source§

fn delete<'a, Tx>( tx: &'a Tx, id: &Self::PrimaryKey, ) -> CryptoKeystoreResult<bool>

Use the transaction’s inteface to delete this entity from the database. Read more
Source§

impl EntityDeleteBorrowed for InboxMessage

Source§

fn delete_borrowed<'a, Tx>( tx: &'a Tx, id: Self::BorrowedPrimaryKey<'_>, ) -> CryptoKeystoreResult<bool>

Delete an entity by a borrowed form of its primary key.
Source§

impl EntityGetBorrowed for InboxMessage

Source§

fn get_borrowed( conn: &Connection, key: Self::BorrowedPrimaryKey<'_>, ) -> CryptoKeystoreResult<Option<Self>>

Get an entity by a borrowed form of its primary key.
Source§

impl Eq for InboxMessage

Source§

impl PartialEq for InboxMessage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PrimaryKey for InboxMessage

Source§

type PrimaryKey = InboxMessagePk

Each distinct PrimaryKey uniquely identifies either 0 or 1 instance. Read more
Source§

fn primary_key(&self) -> Self::PrimaryKey

Get this entity’s primary key. Read more
Source§

impl SearchableEntity<ConversationIdRef> for InboxMessage

Source§

fn find_all_matching( conn: &Connection, search_key: &ConversationIdRef, ) -> CryptoKeystoreResult<Vec<Self>>

Find all entities matching the search key. Read more
Source§

fn matches(&self, search_key: &ConversationIdRef) -> bool

true when this entity instance matches the search key. Read more
Source§

impl StructuralPartialEq for InboxMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> MaybeSendSync for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.