Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/app/ClioApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,12 @@ ClioApplication::run(bool const useNgWebServer)

auto const amendmentCenter = std::make_shared<data::AmendmentCenter const>(backend);

{
auto const migrationInspector = migration::makeMigrationInspector(config_, backend);
// Check if any migration is blocking Clio server starting.
if (migrationInspector->isBlockingClio() and backend->hardFetchLedgerRangeNoThrow()) {
LOG(util::LogService::error()) << "Existing Migration is blocking Clio, Please "
"complete the database migration first.";
return EXIT_FAILURE;
}
auto const migrationInspector = migration::makeMigrationInspector(config_, backend);
// Check if any migration is blocking Clio server starting.
if (migrationInspector->isBlockingClio() and backend->hardFetchLedgerRangeNoThrow()) {
LOG(util::LogService::error()) << "Existing Migration is blocking Clio, Please "
"complete the database migration first.";
return EXIT_FAILURE;
}

// Manages clients subscribed to streams
Expand Down Expand Up @@ -166,7 +164,14 @@ ClioApplication::run(bool const useNgWebServer)
auto counters = rpc::Counters::makeCounters(workQueue);

auto const handlerProvider = std::make_shared<rpc::impl::ProductionHandlerProvider const>(
config_, backend, subscriptions, balancer, etl, amendmentCenter, counters
config_,
backend,
subscriptions,
balancer,
etl,
amendmentCenter,
migrationInspector,
counters
);

using RPCEngineType = rpc::RPCEngine<rpc::Counters>;
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ target_sources(
handlers/LedgerIndex.cpp
handlers/LedgerRange.cpp
handlers/MPTHolders.cpp
handlers/MPTokenIssuanceHistory.cpp
handlers/NFTsByIssuer.cpp
handlers/NFTBuyOffers.cpp
handlers/NFTHistory.cpp
Expand All @@ -58,4 +59,4 @@ target_sources(
handlers/VaultInfo.cpp
)

target_link_libraries(clio_rpc PUBLIC clio_util clio_data)
target_link_libraries(clio_rpc PUBLIC clio_util clio_data clio_migration)
1 change: 1 addition & 0 deletions src/rpc/RPCCenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ handledRpcs()
"ledger_index",
"ledger_range",
"mpt_holders",
"mptoken_issuance_history",
"nfts_by_issuer",
"nft_history",
"nft_buy_offers",
Expand Down
6 changes: 6 additions & 0 deletions src/rpc/common/impl/HandlerProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "etl/ETLServiceInterface.hpp"
#include "etl/LoadBalancerInterface.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "migration/MigrationInspectorInterface.hpp"
#include "rpc/Counters.hpp"
#include "rpc/common/AnyHandler.hpp"
#include "rpc/handlers/AMMInfo.hpp"
Expand All @@ -30,6 +31,7 @@
#include "rpc/handlers/LedgerIndex.hpp"
#include "rpc/handlers/LedgerRange.hpp"
#include "rpc/handlers/MPTHolders.hpp"
#include "rpc/handlers/MPTokenIssuanceHistory.hpp"
#include "rpc/handlers/NFTBuyOffers.hpp"
#include "rpc/handlers/NFTHistory.hpp"
#include "rpc/handlers/NFTInfo.hpp"
Expand Down Expand Up @@ -61,6 +63,7 @@ ProductionHandlerProvider::ProductionHandlerProvider(
std::shared_ptr<etl::LoadBalancerInterface> const& balancer,
std::shared_ptr<etl::ETLServiceInterface const> const& etl,
std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter,
std::shared_ptr<migration::MigrationInspectorInterface const> const& migrationInspector,
Counters const& counters
)
: handlerMap_{
Expand Down Expand Up @@ -91,6 +94,9 @@ ProductionHandlerProvider::ProductionHandlerProvider(
{"ledger_range", {.handler = LedgerRangeHandler{backend}}},
{"mpt_holders",
{.handler = MPTHoldersHandler{backend}, .isClioOnly = true}}, // clio only
{"mptoken_issuance_history",
{.handler = MPTokenIssuanceHistoryHandler{backend, migrationInspector},
.isClioOnly = true}}, // clio only
{"nfts_by_issuer",
{.handler = NFTsByIssuerHandler{backend}, .isClioOnly = true}}, // clio only
{"nft_history",
Expand Down
2 changes: 2 additions & 0 deletions src/rpc/common/impl/HandlerProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "etl/ETLServiceInterface.hpp"
#include "etl/LoadBalancerInterface.hpp"
#include "feed/SubscriptionManagerInterface.hpp"
#include "migration/MigrationInspectorInterface.hpp"
#include "rpc/common/AnyHandler.hpp"
#include "rpc/common/HandlerProvider.hpp"
#include "rpc/common/Types.hpp"
Expand Down Expand Up @@ -38,6 +39,7 @@ class ProductionHandlerProvider final : public HandlerProvider {
std::shared_ptr<etl::LoadBalancerInterface> const& balancer,
std::shared_ptr<etl::ETLServiceInterface const> const& etl,
std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter,
std::shared_ptr<migration::MigrationInspectorInterface const> const& migrationInspector,
Counters const& counters
);

Expand Down
Loading