pub struct MessageHistory {
tree: Tree,
encryption: Option<StorageEncryption>,
}Expand description
A MessageStore implementation using sled for storage.
Fields§
§tree: Tree§encryption: Option<StorageEncryption>Implementations§
Source§impl MessageHistory
impl MessageHistory
Sourcefn get_conversation_id(p1: &PeerId, p2: &PeerId) -> Vec<u8> ⓘ
fn get_conversation_id(p1: &PeerId, p2: &PeerId) -> Vec<u8> ⓘ
Creates a canonical, ordered conversation ID from two PeerIds.
This ensures that the conversation ID is always the same regardless of
the order of the PeerIds.
Sourcefn make_composite_key(
conversation_id: &[u8],
timestamp: i64,
nonce: u64,
) -> Vec<u8> ⓘ
fn make_composite_key( conversation_id: &[u8], timestamp: i64, nonce: u64, ) -> Vec<u8> ⓘ
Creates a composite key for storing a message, based on conversation ID, timestamp, and nonce.
Sourcefn serialize_message(&self, msg: &Message) -> Result<Vec<u8>>
fn serialize_message(&self, msg: &Message) -> Result<Vec<u8>>
Serializes a Message and encrypts it if encryption is enabled.
Sourcefn deserialize_message(&self, data: &[u8]) -> Result<Message>
fn deserialize_message(&self, data: &[u8]) -> Result<Message>
Decrypts and deserializes a Message.
Trait Implementations§
Source§impl MessageStore for MessageHistory
impl MessageStore for MessageHistory
Source§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 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,
Stores a message in the history. Read more
Source§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_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,
Retrieves a message by its ID. Read more
Source§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_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. Read more
Source§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_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. Read more
Source§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_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. Read more
Source§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 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. Read more
Source§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,
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,
Updates the delivery status of a message. Read more
Auto Trait Implementations§
impl Freeze for MessageHistory
impl !RefUnwindSafe for MessageHistory
impl Send for MessageHistory
impl Sync for MessageHistory
impl Unpin for MessageHistory
impl !UnwindSafe for MessageHistory
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more