pub trait MessageStore {
// Required methods
fn store_message<'life0, 'async_trait>(
&'life0 self,
msg: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_message_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
msg_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_recent_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_messages_before<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
before_id: &'life3 Uuid,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get_messages_after<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
after_id: &'life3 Uuid,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn update_delivery_status<'life0, 'life1, 'async_trait>(
&'life0 self,
msg_id: &'life1 Uuid,
status: DeliveryStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A trait for storing and retrieving messages.
Required Methods§
Sourcefn store_message<'life0, 'async_trait>(
&'life0 self,
msg: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_message<'life0, 'async_trait>(
&'life0 self,
msg: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn get_message_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
msg_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_message_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
msg_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn get_history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieves the message history for a conversation.
Messages are returned in chronological order.
§Arguments
own_id- ThePeerIdof the local user.peer- ThePeerIdof the other participant in the conversation.limit- The maximum number of messages to retrieve.
§Returns
A Vec of Messages representing the conversation history.
§Errors
This function will return an error if the history cannot be retrieved.
Sourcefn get_recent_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_recent_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves a limited number of the most recent messages from all conversations.
Messages are returned in chronological order, up to the specified limit.
§Arguments
own_id- ThePeerIdof the local user (used for filtering relevant messages).limit- The maximum number of recent messages to retrieve.
§Returns
A Vec of Messages, sorted chronologically.
§Errors
This function will return an error if the messages cannot be retrieved.
Sourcefn get_messages_before<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
before_id: &'life3 Uuid,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_messages_before<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
before_id: &'life3 Uuid,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Retrieves messages before a specific message in a conversation.
Messages are returned in chronological order.
§Arguments
own_id- ThePeerIdof the local user.peer- ThePeerIdof the other participant in the conversation.before_id- TheUuidof the message to retrieve messages before.limit- The maximum number of messages to retrieve.
§Returns
A Vec of Messages.
§Errors
This function will return an error if the messages cannot be retrieved.
Sourcefn get_messages_after<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
after_id: &'life3 Uuid,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_messages_after<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
own_id: &'life1 PeerId,
peer: &'life2 PeerId,
after_id: &'life3 Uuid,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Retrieves messages after a specific message in a conversation.
Messages are returned in chronological order.
§Arguments
own_id- ThePeerIdof the local user.peer- ThePeerIdof the other participant in the conversation.after_id- TheUuidof the message to retrieve messages after.limit- The maximum number of messages to retrieve.
§Returns
A Vec of Messages.
§Errors
This function will return an error if the messages cannot be retrieved.