pub trait XmtpMlsStorageProvider:
MaybeSend
+ MaybeSync
+ StorageProvider<CURRENT_VERSION, Error = SqlKeyStoreError> {
type Connection: ConnectionExt;
type TxQuery: TransactionalKeyStore;
type DbQuery<'a>: DbQuery
where Self::Connection: 'a;
// Required methods
fn db<'a>(&'a self) -> Self::DbQuery<'a>;
fn transaction<T, E, F>(&self, f: F) -> Result<T, E>
where F: FnOnce(&mut Self::TxQuery) -> Result<T, E>,
E: From<Error> + From<ConnectionError> + Error;
fn savepoint<T, E, F>(&self, f: F) -> Result<T, E>
where F: FnOnce(&mut Self::TxQuery) -> Result<T, E>,
E: From<Error> + From<ConnectionError> + Error;
fn read<V: Entity<CURRENT_VERSION>>(
&self,
label: &[u8],
key: &[u8],
) -> Result<Option<V>, SqlKeyStoreError>;
fn read_list<V: Entity<CURRENT_VERSION>>(
&self,
label: &[u8],
key: &[u8],
) -> Result<Vec<V>, <Self as StorageProvider<CURRENT_VERSION>>::Error>;
fn delete(
&self,
label: &[u8],
key: &[u8],
) -> Result<(), <Self as StorageProvider<CURRENT_VERSION>>::Error>;
fn write(
&self,
label: &[u8],
key: &[u8],
value: &[u8],
) -> Result<(), <Self as StorageProvider<CURRENT_VERSION>>::Error>;
fn hash_all(&self) -> Result<Vec<u8>, SqlKeyStoreError>;
// Provided method
fn _disable_lint_for_self<'a>(_: Self::DbQuery<'a>) { ... }
}Expand description
Convenience super trait to constrain the storage provider to a specific error type and version This storage provider is likewise implemented on both &T and T references, to allow creating a referenced or owned provider.
Required Associated Types§
Sourcetype Connection: ConnectionExt
type Connection: ConnectionExt
An Opaque Database connection type. Can be anything.
type TxQuery: TransactionalKeyStore
type DbQuery<'a>: DbQuery where Self::Connection: 'a
Required Methods§
fn db<'a>(&'a self) -> Self::DbQuery<'a>
Sourcefn transaction<T, E, F>(&self, f: F) -> Result<T, E>
fn transaction<T, E, F>(&self, f: F) -> Result<T, E>
Start a new transaction
Sourcefn savepoint<T, E, F>(&self, f: F) -> Result<T, E>
fn savepoint<T, E, F>(&self, f: F) -> Result<T, E>
Start a savepoint within a transaction Must only be used when already in a transaction
fn read<V: Entity<CURRENT_VERSION>>( &self, label: &[u8], key: &[u8], ) -> Result<Option<V>, SqlKeyStoreError>
fn read_list<V: Entity<CURRENT_VERSION>>( &self, label: &[u8], key: &[u8], ) -> Result<Vec<V>, <Self as StorageProvider<CURRENT_VERSION>>::Error>
fn delete( &self, label: &[u8], key: &[u8], ) -> Result<(), <Self as StorageProvider<CURRENT_VERSION>>::Error>
fn write( &self, label: &[u8], key: &[u8], value: &[u8], ) -> Result<(), <Self as StorageProvider<CURRENT_VERSION>>::Error>
fn hash_all(&self) -> Result<Vec<u8>, SqlKeyStoreError>
Provided Methods§
fn _disable_lint_for_self<'a>(_: Self::DbQuery<'a>)
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.