Skip to main content

Entity

Trait Entity 

Source
pub trait Entity: PrimaryKey + Sized {
    const COLLECTION_NAME: &'static str;

    // Required methods
    fn get(
        conn: &Connection,
        key: &Self::PrimaryKey,
    ) -> CryptoKeystoreResult<Option<Self>>;
    fn count(conn: &Connection) -> CryptoKeystoreResult<u32>;
    fn load_all(conn: &Connection) -> CryptoKeystoreResult<Vec<Self>>;
}
Expand description

Something which can be stored in our database.

It has a primary key, which uniquely identifies it.

Required Associated Constants§

Source

const COLLECTION_NAME: &'static str

The table name for this entity

Required Methods§

Source

fn get( conn: &Connection, key: &Self::PrimaryKey, ) -> CryptoKeystoreResult<Option<Self>>

Get an entity by its primary key.

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

fn get(conn: &Connection, key: &Self::PrimaryKey) -> CoreCryptoKeystoreResult<Option<Self>> {
    Self::get_borrowed(conn, key).await
}
Source

fn count(conn: &Connection) -> CryptoKeystoreResult<u32>

Count the number of entities of this type in the database.

Source

fn load_all(conn: &Connection) -> CryptoKeystoreResult<Vec<Self>>

Retrieve all entities of this type from the database.

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 Entity for E2eiCrl

Source§

const COLLECTION_NAME: &'static str = "e2ei_crls"

Source§

impl Entity for E2eiIntermediateCert

Source§

const COLLECTION_NAME: &'static str = "e2ei_intermediate_certs"

Source§

impl Entity for MlsPendingMessage

Source§

const COLLECTION_NAME: &'static str = "mls_pending_messages"

Source§

impl Entity for PersistedMlsGroup

Source§

const COLLECTION_NAME: &'static str = "mls_groups"

Source§

impl Entity for PersistedMlsPendingGroup

Source§

const COLLECTION_NAME: &'static str = "mls_pending_groups"

Source§

impl Entity for ProteusIdentity

Source§

const COLLECTION_NAME: &'static str = "proteus_identities"

Source§

impl Entity for ProteusPrekey

Source§

const COLLECTION_NAME: &'static str = "proteus_prekeys"

Source§

impl Entity for ProteusSession

Source§

const COLLECTION_NAME: &'static str = "proteus_sessions"

Source§

impl Entity for StoredBufferedCommit

Source§

const COLLECTION_NAME: &'static str = "mls_buffered_commits"

Source§

impl Entity for StoredCredential

Source§

const COLLECTION_NAME: &'static str = "mls_credentials"

Source§

impl Entity for StoredEncryptionKeyPair

Source§

const COLLECTION_NAME: &'static str = "mls_encryption_keypairs"

Source§

impl Entity for StoredEpochEncryptionKeypair

Source§

const COLLECTION_NAME: &'static str = "mls_epoch_encryption_keypairs"

Source§

impl Entity for StoredHpkePrivateKey

Source§

const COLLECTION_NAME: &'static str = "mls_hpke_private_keys"

Source§

impl Entity for StoredKeypackage

Source§

const COLLECTION_NAME: &'static str = "mls_keypackages"

Source§

impl Entity for StoredPskBundle

Source§

const COLLECTION_NAME: &'static str = "mls_psk_bundles"

Source§

impl<T> Entity for T

Source§

const COLLECTION_NAME: &'static str = <Self as UniqueEntityImplementationHelper>::COLLECTION_NAME