pub struct PersistenceManager { /* private fields */ }Implementations§
Source§impl PersistenceManager
impl PersistenceManager
Sourcepub async fn new(backend: Arc<dyn Backend>) -> Result<Self, StoreError>
pub async fn new(backend: Arc<dyn Backend>) -> Result<Self, StoreError>
Create a PersistenceManager with a backend implementation.
Note: The backend should already be configured with the correct device_id (via SqliteStore::new_for_device for multi-account scenarios).
Sourcepub async fn get_device_arc(&self) -> Arc<RwLock<Device>> ⓘ
pub async fn get_device_arc(&self) -> Arc<RwLock<Device>> ⓘ
Handle for store adapters that need &mut Device trait access.
For plain reads, prefer get_device_snapshot.
Sourcepub fn get_device_snapshot(&self) -> Arc<Device> ⓘ
pub fn get_device_snapshot(&self) -> Arc<Device> ⓘ
Cheap point-in-time view of the device state: an Arc refcount bump,
no locking against writers and no Device clone. Always reflects the
last committed modify_device/process_command mutation.
pub fn backend(&self) -> Arc<dyn Backend> ⓘ
Sourcepub fn is_saver_halted(&self) -> bool
pub fn is_saver_halted(&self) -> bool
Returns true if the background saver halted due to repeated flush failures.
pub async fn modify_device<F, R>(&self, modifier: F) -> R
Sourcepub async fn flush(&self) -> Result<(), StoreError>
pub async fn flush(&self) -> Result<(), StoreError>
Flush any dirty device state to the backend immediately.
Sourcepub async fn create_snapshot(
&self,
name: &str,
extra_content: Option<&[u8]>,
) -> Result<(), StoreError>
pub async fn create_snapshot( &self, name: &str, extra_content: Option<&[u8]>, ) -> Result<(), StoreError>
Triggers a snapshot of the underlying storage backend. Useful for debugging critical errors like crypto state corruption.
Sourcepub fn run_background_saver(
self: Arc<Self>,
runtime: Arc<dyn Runtime>,
interval: Duration,
shutdown: ShutdownSignal,
) -> AbortHandle
pub fn run_background_saver( self: Arc<Self>, runtime: Arc<dyn Runtime>, interval: Duration, shutdown: ShutdownSignal, ) -> AbortHandle
Spawn the background saver. The task wakes on save_notify, the
interval tick, or the shutdown signal; runs save_to_disk after
each wake (no-op when the dirty flag is clear); and performs a final
flush before exiting on shutdown.
Caller must keep the returned AbortHandle — dropping it aborts
the task. ShutdownSignal is sticky (see ShutdownNotifier):
a notify that races the task’s first listen()
is observed via the flag on the first iteration, so no data is stranded.
Source§impl PersistenceManager
impl PersistenceManager
pub async fn process_command(&self, command: DeviceCommand)
Source§impl PersistenceManager
impl PersistenceManager
pub async fn get_sender_key_devices( &self, group_jid: &str, ) -> Result<Vec<(String, bool)>, StoreError>
pub async fn set_sender_key_status( &self, group_jid: &str, entries: &[(&str, bool)], ) -> Result<(), StoreError>
pub async fn clear_sender_key_devices( &self, group_jid: &str, ) -> Result<(), StoreError>
pub async fn delete_sender_key_device_rows( &self, device_jids: &[&str], ) -> Result<(), StoreError>
Auto Trait Implementations§
impl !Freeze for PersistenceManager
impl !RefUnwindSafe for PersistenceManager
impl !UnwindSafe for PersistenceManager
impl Send for PersistenceManager
impl Sync for PersistenceManager
impl Unpin for PersistenceManager
impl UnsafeUnpin for PersistenceManager
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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