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: ConversationIdConversation for which this message is intended.
message: Vec<u8>Encrypted message data.
content_type: ContentTypeWhat kind of message this is.
waiting_for: WaitingForWhat event this message is waiting for.
epoch: u64Epoch of this message.
arrival_sequence: u64An arbitrary monotonically increasing integer.
See crate::Transaction::inbox_message_next_arrival_sequence.
Implementations§
Source§impl InboxMessage
impl InboxMessage
Sourcepub fn take<'a, Tx>(
tx: &'a Tx,
conversation_id: &ConversationIdRef,
waiting_for: WaitingFor,
epoch: Option<u64>,
) -> CryptoKeystoreResult<Vec<Self>>
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.
Sourcepub fn drop_stale<'a, Tx>(
tx: &'a Tx,
conversation_id: &ConversationIdRef,
new_epoch: u64,
) -> CryptoKeystoreResult<usize>
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
impl BorrowPrimaryKey for InboxMessage
type BorrowedPrimaryKey<'a> = InboxMessagePkRef<'a> where Self: 'a
Source§fn borrow_primary_key(&self) -> Self::BorrowedPrimaryKey<'_>
fn borrow_primary_key(&self) -> Self::BorrowedPrimaryKey<'_>
Source§impl Clone for InboxMessage
impl Clone for InboxMessage
Source§impl Debug for InboxMessage
impl Debug for InboxMessage
Source§impl DeletableBySearchKey<ConversationIdRef> for InboxMessage
impl DeletableBySearchKey<ConversationIdRef> for InboxMessage
Source§fn delete_all_matching<'a, Tx>(
tx: &'a Tx,
search_key: &ConversationIdRef,
) -> CryptoKeystoreResult<()>
fn delete_all_matching<'a, Tx>( tx: &'a Tx, search_key: &ConversationIdRef, ) -> CryptoKeystoreResult<()>
Source§impl Entity for InboxMessage
impl Entity for InboxMessage
Source§const TABLE_NAME: &str = Self::TABLE
const TABLE_NAME: &str = Self::TABLE
Source§fn get(
conn: &Connection,
key: &Self::PrimaryKey,
) -> CryptoKeystoreResult<Option<Self>>
fn get( conn: &Connection, key: &Self::PrimaryKey, ) -> CryptoKeystoreResult<Option<Self>>
Source§fn count(conn: &Connection) -> CryptoKeystoreResult<u32>
fn count(conn: &Connection) -> CryptoKeystoreResult<u32>
Source§fn load_all(conn: &Connection) -> CryptoKeystoreResult<Vec<Self>>
fn load_all(conn: &Connection) -> CryptoKeystoreResult<Vec<Self>>
Source§impl EntityDatabaseMutation for InboxMessage
impl EntityDatabaseMutation for InboxMessage
Source§fn save<'a, Tx>(&self, tx: &'a Tx) -> CryptoKeystoreResult<()>
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>
fn delete<'a, Tx>( tx: &'a Tx, id: &Self::PrimaryKey, ) -> CryptoKeystoreResult<bool>
Source§impl EntityDeleteBorrowed for InboxMessage
impl EntityDeleteBorrowed for InboxMessage
Source§fn delete_borrowed<'a, Tx>(
tx: &'a Tx,
id: Self::BorrowedPrimaryKey<'_>,
) -> CryptoKeystoreResult<bool>
fn delete_borrowed<'a, Tx>( tx: &'a Tx, id: Self::BorrowedPrimaryKey<'_>, ) -> CryptoKeystoreResult<bool>
Source§impl EntityGetBorrowed for InboxMessage
impl EntityGetBorrowed for InboxMessage
Source§fn get_borrowed(
conn: &Connection,
key: Self::BorrowedPrimaryKey<'_>,
) -> CryptoKeystoreResult<Option<Self>>
fn get_borrowed( conn: &Connection, key: Self::BorrowedPrimaryKey<'_>, ) -> CryptoKeystoreResult<Option<Self>>
impl Eq for InboxMessage
Source§impl PartialEq for InboxMessage
impl PartialEq for InboxMessage
Source§impl PrimaryKey for InboxMessage
impl PrimaryKey for InboxMessage
Source§type PrimaryKey = InboxMessagePk
type PrimaryKey = InboxMessagePk
PrimaryKey uniquely identifies either 0 or 1 instance. Read moreSource§fn primary_key(&self) -> Self::PrimaryKey
fn primary_key(&self) -> Self::PrimaryKey
Source§impl SearchableEntity<ConversationIdRef> for InboxMessage
impl SearchableEntity<ConversationIdRef> for InboxMessage
Source§fn find_all_matching(
conn: &Connection,
search_key: &ConversationIdRef,
) -> CryptoKeystoreResult<Vec<Self>>
fn find_all_matching( conn: &Connection, search_key: &ConversationIdRef, ) -> CryptoKeystoreResult<Vec<Self>>
impl StructuralPartialEq for InboxMessage
Auto Trait Implementations§
impl Freeze for InboxMessage
impl RefUnwindSafe for InboxMessage
impl Send for InboxMessage
impl Sync for InboxMessage
impl Unpin for InboxMessage
impl UnsafeUnpin for InboxMessage
impl UnwindSafe for InboxMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.