XmtpDb

Trait XmtpDb 

Source
pub trait XmtpDb: MaybeSend + MaybeSync {
    type Connection: ConnectionExt + MaybeSend + MaybeSync;
    type DbQuery: DbQuery + MaybeSend + MaybeSync;

    // Required methods
    fn opts(&self) -> &StorageOption;
    fn conn(&self) -> Self::Connection;
    fn db(&self) -> Self::DbQuery;
    fn reconnect(&self) -> Result<(), ConnectionError>;
    fn disconnect(&self) -> Result<(), ConnectionError>;

    // Provided methods
    fn init(&self) -> Result<(), ConnectionError> { ... }
    fn validate(
        &self,
        _conn: &mut SqliteConnection,
    ) -> Result<(), ConnectionError> { ... }
}

Required Associated Types§

Source

type Connection: ConnectionExt + MaybeSend + MaybeSync

The Connection type for this database

Source

type DbQuery: DbQuery + MaybeSend + MaybeSync

Required Methods§

Source

fn opts(&self) -> &StorageOption

The Options this database was created with

Source

fn conn(&self) -> Self::Connection

Returns the Connection implementation for this Database

Source

fn db(&self) -> Self::DbQuery

Returns a higher-level wrapeped DbConnection from which high-level queries may be accessed.

Source

fn reconnect(&self) -> Result<(), ConnectionError>

Reconnect to the database

Source

fn disconnect(&self) -> Result<(), ConnectionError>

Release connection to the database, closing it

Provided Methods§

Source

fn init(&self) -> Result<(), ConnectionError>

Source

fn validate(&self, _conn: &mut SqliteConnection) -> Result<(), ConnectionError>

Validate a connection is as expected

Implementors§