EntityDatabaseMutation

Trait EntityDatabaseMutation 

Source
pub trait EntityDatabaseMutation<'a>: Entity<ConnectionType = KeystoreDatabaseConnection> {
    type Transaction: 'a;

    // Required methods
    fn save<'life0, 'async_trait>(
        &'a self,
        tx: &'life0 Self::Transaction,
    ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait;
    fn count<'life0, 'async_trait>(
        tx: &'life0 Self::Transaction,
    ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<u32>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        tx: &'life0 Self::Transaction,
        id: &'life1 <Self as Entity>::PrimaryKey,
    ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn pre_save<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Self::AutoGeneratedFields>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Extend an Entity with db-mutating operations which can be performed when provided with a transaction.

Required Associated Types§

Required Methods§

Source

fn save<'life0, 'async_trait>( &'a self, tx: &'life0 Self::Transaction, ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Use the transaction’s interface to save this entity to the database

Source

fn count<'life0, 'async_trait>( tx: &'life0 Self::Transaction, ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<u32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Use the transaction’s interface to count the number of entities of this type in the database.

Source

fn delete<'life0, 'life1, 'async_trait>( tx: &'life0 Self::Transaction, id: &'life1 <Self as Entity>::PrimaryKey, ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Use the transaction’s inteface to delete this entity from the database.

Returns true if at least one entity was deleted, or false if the id was not found in the database.

For entites whose primary key has a distinct borrowed type, it is best to implement this as a direct passthrough:

async fn delete(tx: &Self::Transaction, key: &Self::PrimaryKey) -> CoreCryptoKeystoreResult<bool> {
    <Self as EntityTransactionDeleteBorrowed<'a>>::delete_borrowed(tx, id).await
}

Provided Methods§

Source

fn pre_save<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<Self::AutoGeneratedFields>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Adjust self before saving.

This will be called by the transaction’s implementation of save_mut and should not be called as part of the save implementation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> EntityDatabaseMutation<'a> for E2eiCrl

Source§

impl<'a> EntityDatabaseMutation<'a> for E2eiIntermediateCert

Source§

impl<'a> EntityDatabaseMutation<'a> for MlsPendingMessage

Source§

impl<'a> EntityDatabaseMutation<'a> for PersistedMlsGroup

Source§

impl<'a> EntityDatabaseMutation<'a> for PersistedMlsPendingGroup

Source§

impl<'a> EntityDatabaseMutation<'a> for ProteusIdentity

Source§

impl<'a> EntityDatabaseMutation<'a> for ProteusPrekey

Source§

impl<'a> EntityDatabaseMutation<'a> for ProteusSession

Source§

impl<'a> EntityDatabaseMutation<'a> for StoredBufferedCommit

Source§

impl<'a> EntityDatabaseMutation<'a> for StoredCredential

Source§

impl<'a> EntityDatabaseMutation<'a> for StoredE2eiEnrollment

Source§

impl<'a> EntityDatabaseMutation<'a> for StoredEncryptionKeyPair

Source§

impl<'a> EntityDatabaseMutation<'a> for StoredEpochEncryptionKeypair

Source§

impl<'a> EntityDatabaseMutation<'a> for StoredHpkePrivateKey

Source§

impl<'a> EntityDatabaseMutation<'a> for StoredKeypackage

Source§

impl<'a> EntityDatabaseMutation<'a> for StoredPskBundle

Source§

impl<'a, T> EntityDatabaseMutation<'a> for T
where T: EntityBase<ConnectionType = KeystoreDatabaseConnection, AutoGeneratedFields = ()> + UniqueEntityImplementationHelper + Sync,