pub struct SignalStoreCache { /* private fields */ }Expand description
In-memory cache for Signal protocol state, matching WhatsApp Web’s SignalStoreCache.
All crypto operations read/write this cache. DB writes are deferred to flush().
Each store type has its own mutex for independent locking.
Values are stored as Arc<[u8]> so cache reads are O(1) clones (reference count bump)
instead of O(n) byte copies.
Keys use Arc<str> so that cloning a key (needed for both cache and dirty/deleted sets)
is an O(1) refcount bump instead of an O(n) heap allocation.
Implementations§
Source§impl SignalStoreCache
impl SignalStoreCache
pub fn new() -> SignalStoreCache
pub async fn get_session( &self, address: &str, backend: &dyn SignalStore, ) -> Result<Option<Arc<[u8]>>, Error>
pub async fn put_session(&self, address: &str, data: &[u8])
pub async fn delete_session(&self, address: &str)
pub async fn has_session( &self, address: &str, backend: &dyn SignalStore, ) -> Result<bool, Error>
pub async fn get_identity( &self, address: &str, backend: &dyn SignalStore, ) -> Result<Option<Arc<[u8]>>, Error>
pub async fn put_identity(&self, address: &str, data: &[u8])
pub async fn delete_identity(&self, address: &str)
pub async fn get_sender_key( &self, address: &str, backend: &dyn SignalStore, ) -> Result<Option<Arc<[u8]>>, Error>
pub async fn put_sender_key(&self, address: &str, data: &[u8])
Sourcepub async fn flush(&self, backend: &dyn SignalStore) -> Result<(), Error>
pub async fn flush(&self, backend: &dyn SignalStore) -> Result<(), Error>
Flush all dirty state to the backend in a single batch. Acquires all 3 mutexes to ensure consistency (matches WhatsApp Web’s pattern).
Dirty sets are only cleared after ALL writes succeed. If any write fails,
dirty tracking is preserved so the next flush retries everything.
This matches WA Web’s clearDirty() which runs only after successful persist.
Trait Implementations§
Source§impl Default for SignalStoreCache
impl Default for SignalStoreCache
Source§fn default() -> SignalStoreCache
fn default() -> SignalStoreCache
Auto Trait Implementations§
impl !Freeze for SignalStoreCache
impl !RefUnwindSafe for SignalStoreCache
impl Send for SignalStoreCache
impl Sync for SignalStoreCache
impl Unpin for SignalStoreCache
impl UnsafeUnpin for SignalStoreCache
impl UnwindSafe for SignalStoreCache
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more