Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
migration::impl::MigratorsRegister< Backend, MigratorType > Class Template Reference

The register of migrators. It will dispatch the migration to the corresponding migrator. It also hold the shared pointer of backend, which is used by the migrators. More...

#include <MigratorsRegister.hpp>

Public Types

using BackendType = Backend
 The backend type which is used by the migrators.
 

Public Member Functions

 MigratorsRegister (std::shared_ptr< BackendType > backend)
 Construct a new Migrators Register object.
 
void runMigrator (std::string const &name, util::config::ObjectView const &config)
 Run the migration according to the given migrator's name.
 
std::vector< std::tuple< std::string, MigratorStatus > > getMigratorsStatus () const
 Get the status of all the migrators.
 
MigratorStatus getMigratorStatus (std::string const &name) const
 Get the status of a migrator by its name.
 
constexpr auto getMigratorNames () const
 Get all registered migrators' names.
 
std::string getMigratorDescription (std::string const &name) const
 Get the description of a migrator by its name.
 
std::optional< bool > canMigratorBlockClio (std::string_view name) const
 Return if the given migrator can block Clio server.
 

Detailed Description

template<typename Backend, typename... MigratorType>
requires AllMigratorSpec<MigratorType...>
class migration::impl::MigratorsRegister< Backend, MigratorType >

The register of migrators. It will dispatch the migration to the corresponding migrator. It also hold the shared pointer of backend, which is used by the migrators.

Template Parameters
BackendThe backend type
MigratorTypeThe migrator types. It should be a concept of MigratorSpec and not have duplicate names.

Constructor & Destructor Documentation

◆ MigratorsRegister()

template<typename Backend , typename... MigratorType>
migration::impl::MigratorsRegister< Backend, MigratorType >::MigratorsRegister ( std::shared_ptr< BackendType > backend)
inline

Construct a new Migrators Register object.

Parameters
backendThe backend shared pointer

Member Function Documentation

◆ canMigratorBlockClio()

template<typename Backend , typename... MigratorType>
std::optional< bool > migration::impl::MigratorsRegister< Backend, MigratorType >::canMigratorBlockClio ( std::string_view name) const
inline

Return if the given migrator can block Clio server.

Parameters
nameThe migrator's name
Returns
std::nullopt if the migrator name is not found, or a boolean value indicating whether the migrator is blocking Clio server.

◆ getMigratorDescription()

template<typename Backend , typename... MigratorType>
std::string migration::impl::MigratorsRegister< Backend, MigratorType >::getMigratorDescription ( std::string const & name) const
inline

Get the description of a migrator by its name.

Parameters
nameThe migrator's name
Returns
The description of the migrator

◆ getMigratorNames()

template<typename Backend , typename... MigratorType>
auto migration::impl::MigratorsRegister< Backend, MigratorType >::getMigratorNames ( ) const
inlineconstexpr

Get all registered migrators' names.

Returns
A array of migrator's names

◆ getMigratorsStatus()

template<typename Backend , typename... MigratorType>
std::vector< std::tuple< std::string, MigratorStatus > > migration::impl::MigratorsRegister< Backend, MigratorType >::getMigratorsStatus ( ) const
inline

Get the status of all the migrators.

Returns
A vector of tuple, the first element is the migrator's name, the second element is the status of the migrator

◆ getMigratorStatus()

template<typename Backend , typename... MigratorType>
MigratorStatus migration::impl::MigratorsRegister< Backend, MigratorType >::getMigratorStatus ( std::string const & name) const
inline

Get the status of a migrator by its name.

Parameters
nameThe migrator's name to get the status
Returns
The status of the migrator

◆ runMigrator()

template<typename Backend , typename... MigratorType>
void migration::impl::MigratorsRegister< Backend, MigratorType >::runMigrator ( std::string const & name,
util::config::ObjectView const & config )
inline

Run the migration according to the given migrator's name.

Parameters
nameThe migrator's name
configThe configuration of the migration

The documentation for this class was generated from the following file: