Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
MigrationManagerBase.hpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of clio: https://github.com/XRPLF/clio
4 Copyright (c) 2024, the clio developers.
5
6 Permission to use, copy, modify, and distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#pragma once
21
22#include "migration/MigrationManagerInterface.hpp"
23#include "migration/impl/MigrationInspectorBase.hpp"
24#include "util/newconfig/ObjectView.hpp"
25
26#include <memory>
27#include <string>
28#include <utility>
29
30namespace migration::impl {
31
38template <typename SupportedMigrators>
39class MigrationManagerBase : public MigrationManagerInterface, public MigrationInspectorBase<SupportedMigrators> {
40 // contains only migration related settings
42
43public:
51 std::shared_ptr<typename SupportedMigrators::BackendType> backend,
53 )
54 : MigrationInspectorBase<SupportedMigrators>{std::move(backend)}, config_{std::move(config)}
55 {
56 }
57
63 void
64 runMigration(std::string const& name) override
65 {
66 this->migrators_.runMigrator(name, config_);
67 }
68};
69
70} // namespace migration::impl
The migration inspector implementation for Cassandra. It will report the migration status for Cassand...
Definition MigrationInspectorBase.hpp:40
The migration manager implementation for Cassandra. It will run the migration for the Cassandra datab...
Definition MigrationManagerBase.hpp:39
void runMigration(std::string const &name) override
Run the the migration according to the given migrator's name.
Definition MigrationManagerBase.hpp:64
MigrationManagerBase(std::shared_ptr< typename SupportedMigrators::BackendType > backend, util::config::ObjectView config)
Construct a new Cassandra Migration Manager object.
Definition MigrationManagerBase.hpp:50
Provides a view into a subset of configuration data defined by a prefix.
Definition ObjectView.hpp:40
The interface for the migration manager. The migration application layer will use this interface to r...
Definition MigrationManagerInterface.hpp:33