pub struct SqliteStore { /* private fields */ }Implementations§
Source§impl SqliteStore
impl SqliteStore
pub async fn new(database_url: &str) -> Result<Self, StoreError>
pub fn begin_transaction( &self, ) -> Result<PooledConnection<ConnectionManager<SqliteConnection>>>
pub fn commit_transaction( &self, conn: &mut PooledConnection<ConnectionManager<SqliteConnection>>, ) -> Result<()>
pub fn rollback_transaction( &self, conn: &mut PooledConnection<ConnectionManager<SqliteConnection>>, ) -> Result<()>
pub async fn save_device_data(&self, device_data: &CoreDevice) -> Result<()>
Sourcepub async fn save_device_data_for_device(
&self,
device_id: i32,
device_data: &CoreDevice,
) -> Result<()>
pub async fn save_device_data_for_device( &self, device_id: i32, device_data: &CoreDevice, ) -> Result<()>
Save device data for a specific device ID (multi-account mode)
pub async fn load_device_data(&self) -> Result<Option<CoreDevice>>
Sourcepub async fn create_new_device(&self) -> Result<i32>
pub async fn create_new_device(&self) -> Result<i32>
Create a new device entry in the database and return its ID
Sourcepub async fn device_exists(&self, device_id: i32) -> Result<bool>
pub async fn device_exists(&self, device_id: i32) -> Result<bool>
Check if a device with the given ID exists
Sourcepub async fn list_device_ids(&self) -> Result<Vec<i32>>
pub async fn list_device_ids(&self) -> Result<Vec<i32>>
List all device IDs in the database
Sourcepub async fn delete_device(&self, device_id: i32) -> Result<()>
pub async fn delete_device(&self, device_id: i32) -> Result<()>
Delete a device and all its associated data
Sourcepub async fn load_device_data_for_device(
&self,
device_id: i32,
) -> Result<Option<CoreDevice>>
pub async fn load_device_data_for_device( &self, device_id: i32, ) -> Result<Option<CoreDevice>>
Load device data for a specific device ID
pub async fn put_identity_for_device( &self, address: &str, key: [u8; 32], device_id: i32, ) -> Result<()>
pub async fn delete_identity_for_device( &self, address: &str, device_id: i32, ) -> Result<()>
pub async fn load_identity_for_device( &self, address: &str, device_id: i32, ) -> Result<Option<Vec<u8>>>
pub async fn get_session_for_device( &self, address: &str, device_id: i32, ) -> Result<Option<Vec<u8>>>
pub async fn put_session_for_device( &self, address: &str, session: &[u8], device_id: i32, ) -> Result<()>
pub async fn delete_session_for_device( &self, address: &str, device_id: i32, ) -> Result<()>
pub async fn has_session_for_device( &self, address: &str, device_id: i32, ) -> Result<bool>
pub async fn put_sender_key_for_device( &self, address: &str, record: &[u8], device_id: i32, ) -> Result<()>
pub async fn get_sender_key_for_device( &self, address: &str, device_id: i32, ) -> Result<Option<Vec<u8>>>
pub async fn delete_sender_key_for_device( &self, address: &str, device_id: i32, ) -> Result<()>
pub async fn get_app_state_sync_key_for_device( &self, key_id: &[u8], device_id: i32, ) -> Result<Option<AppStateSyncKey>>
pub async fn set_app_state_sync_key_for_device( &self, key_id: &[u8], key: AppStateSyncKey, device_id: i32, ) -> Result<()>
pub async fn get_app_state_version_for_device( &self, name: &str, device_id: i32, ) -> Result<HashState>
pub async fn set_app_state_version_for_device( &self, name: &str, state: HashState, device_id: i32, ) -> Result<()>
pub async fn put_app_state_mutation_macs_for_device( &self, name: &str, version: u64, mutations: &[AppStateMutationMAC], device_id: i32, ) -> Result<()>
pub async fn delete_app_state_mutation_macs_for_device( &self, name: &str, index_macs: &[Vec<u8>], device_id: i32, ) -> Result<()>
pub async fn get_app_state_mutation_mac_for_device( &self, name: &str, index_mac: &[u8], device_id: i32, ) -> Result<Option<Vec<u8>>>
Trait Implementations§
Source§impl AppStateKeyStore for SqliteStore
impl AppStateKeyStore for SqliteStore
fn get_app_state_sync_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key_id: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Option<AppStateSyncKey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_app_state_sync_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key_id: &'life1 [u8],
key: AppStateSyncKey,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl AppStateStore for SqliteStore
impl AppStateStore for SqliteStore
fn get_app_state_version<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<HashState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_app_state_version<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
state: HashState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_app_state_mutation_macs<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
mutations: &'life2 [AppStateMutationMAC],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_app_state_mutation_macs<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
index_macs: &'life2 [Vec<u8>],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_app_state_mutation_mac<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
index_mac: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§impl Clone for SqliteStore
impl Clone for SqliteStore
Source§fn clone(&self) -> SqliteStore
fn clone(&self) -> SqliteStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl DevicePersistence for SqliteStore
impl DevicePersistence for SqliteStore
Source§fn save_device_data<'life0, 'life1, 'async_trait>(
&'life0 self,
device_data: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_device_data<'life0, 'life1, 'async_trait>(
&'life0 self,
device_data: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save device data (single device mode)
Source§fn save_device_data_for_device<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: i32,
device_data: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_device_data_for_device<'life0, 'life1, 'async_trait>(
&'life0 self,
device_id: i32,
device_data: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save device data for a specific device ID (multi-account mode)
Source§fn load_device_data<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Device>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_device_data<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Device>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load device data (single device mode)
Source§fn load_device_data_for_device<'life0, 'async_trait>(
&'life0 self,
device_id: i32,
) -> Pin<Box<dyn Future<Output = Result<Option<Device>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_device_data_for_device<'life0, 'async_trait>(
&'life0 self,
device_id: i32,
) -> Pin<Box<dyn Future<Output = Result<Option<Device>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load device data for a specific device ID (multi-account mode)
Source§impl IdentityStore for SqliteStore
impl IdentityStore for SqliteStore
fn put_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
key: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_trusted_identity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 str,
key: &'life2 [u8; 32],
_direction: Direction,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl PreKeyStore for SqliteStore
impl PreKeyStore for SqliteStore
fn load_prekey<'life0, 'async_trait>(
&'life0 self,
prekey_id: u32,
) -> Pin<Box<dyn Future<Output = Result<Option<PreKeyRecordStructure>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_prekey<'life0, 'async_trait>(
&'life0 self,
prekey_id: u32,
record: PreKeyRecordStructure,
uploaded: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn contains_prekey<'life0, 'async_trait>(
&'life0 self,
prekey_id: u32,
) -> Pin<Box<dyn Future<Output = Result<bool, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_prekey<'life0, 'async_trait>(
&'life0 self,
prekey_id: u32,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl SenderKeyStoreHelper for SqliteStore
impl SenderKeyStoreHelper for SqliteStore
fn put_sender_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 str,
record: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_sender_key<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_sender_key<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl SessionStore for SqliteStore
impl SessionStore for SqliteStore
fn get_session<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_session<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
address: &'life1 str,
session: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_session<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_session<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl SignedPreKeyStore for SqliteStore
impl SignedPreKeyStore for SqliteStore
fn load_signed_prekey<'life0, 'async_trait>(
&'life0 self,
signed_prekey_id: u32,
) -> Pin<Box<dyn Future<Output = Result<Option<SignedPreKeyRecordStructure>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_signed_prekeys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SignedPreKeyRecordStructure>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_signed_prekey<'life0, 'async_trait>(
&'life0 self,
signed_prekey_id: u32,
record: SignedPreKeyRecordStructure,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn contains_signed_prekey<'life0, 'async_trait>(
&'life0 self,
signed_prekey_id: u32,
) -> Pin<Box<dyn Future<Output = Result<bool, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_signed_prekey<'life0, 'async_trait>(
&'life0 self,
signed_prekey_id: u32,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for SqliteStore
impl !RefUnwindSafe for SqliteStore
impl Send for SqliteStore
impl Sync for SqliteStore
impl Unpin for SqliteStore
impl !UnwindSafe for SqliteStore
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
Add an aggregate function filter Read more
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>,
Add an aggregate function order Read more
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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)
Converts
&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)
Converts
&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> 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 moreSource§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
Convert
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
Convert
&self to an expression for Diesel’s query builder. Read moreSource§impl<T> WindowExpressionMethods for T
impl<T> WindowExpressionMethods for T
Source§fn over(self) -> Self::Outputwhere
Self: OverDsl,
fn over(self) -> Self::Outputwhere
Self: OverDsl,
Turn a function call into a window function call Read more
Source§fn window_filter<P>(self, f: P) -> Self::Output
fn window_filter<P>(self, f: P) -> Self::Output
Add a filter to the current window function Read more
Source§fn partition_by<E>(self, expr: E) -> Self::Outputwhere
Self: PartitionByDsl<E>,
fn partition_by<E>(self, expr: E) -> Self::Outputwhere
Self: PartitionByDsl<E>,
Add a partition clause to the current window function Read more
Source§fn window_order<E>(self, expr: E) -> Self::Outputwhere
Self: OrderWindowDsl<E>,
fn window_order<E>(self, expr: E) -> Self::Outputwhere
Self: OrderWindowDsl<E>,
Add a order clause to the current window function Read more