Trait ClientModuleInit

Source
pub trait ClientModuleInit: ModuleInit + Sized {
    type Module: ClientModule;

    // Required methods
    fn supported_api_versions(&self) -> MultiApiVersion;
    fn init<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: &'life1 ClientModuleInitArgs<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Module>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn kind() -> ModuleKind { ... }
    fn recover<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _args: &'life1 ClientModuleRecoverArgs<Self>,
        _snapshot: Option<&'life2 <Self::Module as ClientModule>::Backup>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn get_database_migrations(
        &self,
    ) -> BTreeMap<DatabaseVersion, ClientModuleMigrationFn> { ... }
    fn used_db_prefixes(&self) -> Option<BTreeSet<u8>> { ... }
}

Required Associated Types§

Required Methods§

Source

fn supported_api_versions(&self) -> MultiApiVersion

Api versions of the corresponding server side module’s API that this client module implementation can use.

Source

fn init<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 ClientModuleInitArgs<Self>, ) -> Pin<Box<dyn Future<Output = Result<Self::Module>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initialize a ClientModule instance from its config

Provided Methods§

Source

fn kind() -> ModuleKind

Source

fn recover<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _args: &'life1 ClientModuleRecoverArgs<Self>, _snapshot: Option<&'life2 <Self::Module as ClientModule>::Backup>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Recover the state of the client module, optionally from an existing snapshot.

If Err is returned, the higher level client/application might try again at a different time (client restarted, code version changed, etc.)

Source

fn get_database_migrations( &self, ) -> BTreeMap<DatabaseVersion, ClientModuleMigrationFn>

Retrieves the database migrations from the module to be applied to the database before the module is initialized. The database migrations map is indexed on the “from” version.

Source

fn used_db_prefixes(&self) -> Option<BTreeSet<u8>>

Db prefixes used by the module

If Some is returned, it should contain list of database prefixes actually used by the module for it’s keys.

In (some subset of) non-production tests, module database will be scanned for presence of keys that do not belong to this list to verify integrity of data and possibly catch any unforeseen bugs.

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§