//! Storage trait definitions. Implementations live in server/client crates. use crate::errors::ProtocolError; use crate::message::WarzoneMessage; use crate::prekey::{OneTimePreKey, SignedPreKey}; use crate::session::Session; use crate::types::{Fingerprint, MessageId}; pub trait PreKeyStore { fn store_signed_pre_key(&mut self, key: SignedPreKey) -> Result<(), ProtocolError>; fn load_signed_pre_key(&self, id: u32) -> Result, ProtocolError>; fn store_one_time_pre_keys(&mut self, keys: Vec) -> Result<(), ProtocolError>; fn take_one_time_pre_key(&mut self, id: u32) -> Result, ProtocolError>; fn count_one_time_pre_keys(&self) -> Result; } pub trait SessionStore { fn load_session(&self, peer: &Fingerprint) -> Result, ProtocolError>; fn store_session(&mut self, session: &Session) -> Result<(), ProtocolError>; } pub trait MessageQueue { fn queue_message(&mut self, msg: &WarzoneMessage) -> Result<(), ProtocolError>; fn fetch_messages(&self, recipient: &Fingerprint) -> Result, ProtocolError>; fn delete_message(&mut self, id: &MessageId) -> Result<(), ProtocolError>; }