mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 11:55:51 +00:00 
			
		
		
		
	@@ -80,8 +80,8 @@ target_sources(clio PRIVATE
 | 
			
		||||
  src/etl/ETLService.cpp
 | 
			
		||||
  src/etl/LoadBalancer.cpp
 | 
			
		||||
  src/etl/impl/ForwardCache.cpp
 | 
			
		||||
  ## Subscriptions
 | 
			
		||||
  src/subscriptions/SubscriptionManager.cpp
 | 
			
		||||
  ## Feed
 | 
			
		||||
  src/feed/SubscriptionManager.cpp
 | 
			
		||||
  ## RPC
 | 
			
		||||
  src/rpc/Errors.cpp
 | 
			
		||||
  src/rpc/Factories.cpp
 | 
			
		||||
@@ -200,10 +200,10 @@ if(tests)
 | 
			
		||||
    unittests/data/cassandra/ExecutionStrategyTests.cpp
 | 
			
		||||
    unittests/data/cassandra/AsyncExecutorTests.cpp
 | 
			
		||||
    # Webserver
 | 
			
		||||
    unittests/webserver/ServerTests.cpp
 | 
			
		||||
    unittests/webserver/RPCServerHandlerTests.cpp
 | 
			
		||||
    unittests/webserver/WhitelistHandlerTests.cpp
 | 
			
		||||
    unittests/webserver/SweepHandlerTests.cpp)
 | 
			
		||||
    unittests/web/ServerTests.cpp
 | 
			
		||||
    unittests/web/RPCServerHandlerTests.cpp
 | 
			
		||||
    unittests/web/WhitelistHandlerTests.cpp
 | 
			
		||||
    unittests/web/SweepHandlerTests.cpp)
 | 
			
		||||
 | 
			
		||||
  include(CMake/deps/gtest.cmake)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@
 | 
			
		||||
#include <queue>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
/**
 | 
			
		||||
 * @brief This datastructure is used to keep track of the sequence of the most recent ledger validated by the network.
 | 
			
		||||
 *
 | 
			
		||||
@@ -219,3 +220,4 @@ getMarkers(size_t numMarkers)
 | 
			
		||||
    }
 | 
			
		||||
    return markers;
 | 
			
		||||
}
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -21,6 +21,7 @@
 | 
			
		||||
 | 
			
		||||
#include <ripple/protocol/LedgerHeader.h>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
// Database must be populated when this starts
 | 
			
		||||
std::optional<uint32_t>
 | 
			
		||||
ETLService::runETLPipeline(uint32_t startSequence, uint32_t numExtractors)
 | 
			
		||||
@@ -265,3 +266,4 @@ ETLService::ETLService(
 | 
			
		||||
    extractorThreads_ = config.valueOr<uint32_t>("extractor_threads", extractorThreads_);
 | 
			
		||||
    txnThreshold_ = config.valueOr<size_t>("txn_threshold", txnThreshold_);
 | 
			
		||||
}
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -31,7 +31,7 @@
 | 
			
		||||
#include <etl/impl/LedgerLoader.h>
 | 
			
		||||
#include <etl/impl/LedgerPublisher.h>
 | 
			
		||||
#include <etl/impl/Transformer.h>
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
 | 
			
		||||
#include <ripple/proto/org/xrpl/rpc/v1/xrp_ledger.grpc.pb.h>
 | 
			
		||||
@@ -42,7 +42,11 @@
 | 
			
		||||
struct AccountTransactionsData;
 | 
			
		||||
struct NFTTransactionsData;
 | 
			
		||||
struct NFTsData;
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief This class is responsible for continuously extracting data from a p2p node, and writing that data to the
 | 
			
		||||
@@ -60,7 +64,7 @@ class SubscriptionManager;
 | 
			
		||||
class ETLService
 | 
			
		||||
{
 | 
			
		||||
    // TODO: make these template parameters in ETLService
 | 
			
		||||
    using SubscriptionManagerType = SubscriptionManager;
 | 
			
		||||
    using SubscriptionManagerType = feed::SubscriptionManager;
 | 
			
		||||
    using LoadBalancerType = LoadBalancer;
 | 
			
		||||
    using NetworkValidatedLedgersType = NetworkValidatedLedgers;
 | 
			
		||||
    using DataPipeType = etl::detail::ExtractionDataPipe<org::xrpl::rpc::v1::GetLedgerResponse>;
 | 
			
		||||
@@ -258,3 +262,4 @@ private:
 | 
			
		||||
        state_.isAmendmentBlocked = true;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -38,12 +38,14 @@
 | 
			
		||||
 | 
			
		||||
using namespace util;
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<Source>
 | 
			
		||||
LoadBalancer::make_Source(
 | 
			
		||||
    Config const& config,
 | 
			
		||||
    boost::asio::io_context& ioContext,
 | 
			
		||||
    std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
    std::shared_ptr<NetworkValidatedLedgers> networkValidatedLedgers,
 | 
			
		||||
    LoadBalancer& balancer)
 | 
			
		||||
{
 | 
			
		||||
@@ -60,7 +62,7 @@ LoadBalancer::make_LoadBalancer(
 | 
			
		||||
    Config const& config,
 | 
			
		||||
    boost::asio::io_context& ioc,
 | 
			
		||||
    std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
    std::shared_ptr<NetworkValidatedLedgers> validatedLedgers)
 | 
			
		||||
{
 | 
			
		||||
    return std::make_shared<LoadBalancer>(config, ioc, backend, subscriptions, validatedLedgers);
 | 
			
		||||
@@ -70,7 +72,7 @@ LoadBalancer::LoadBalancer(
 | 
			
		||||
    Config const& config,
 | 
			
		||||
    boost::asio::io_context& ioContext,
 | 
			
		||||
    std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
    std::shared_ptr<NetworkValidatedLedgers> nwvl)
 | 
			
		||||
{
 | 
			
		||||
    if (auto value = config.maybeValue<uint32_t>("num_markers"); value)
 | 
			
		||||
@@ -233,3 +235,4 @@ LoadBalancer::execute(Func f, uint32_t ledgerSequence)
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
 | 
			
		||||
#include <data/BackendInterface.h>
 | 
			
		||||
#include <etl/ETLHelpers.h>
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
 | 
			
		||||
@@ -29,9 +29,15 @@
 | 
			
		||||
#include <boost/asio.hpp>
 | 
			
		||||
#include <grpcpp/grpcpp.h>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
class Source;
 | 
			
		||||
class ProbingSource;
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief This class is used to manage connections to transaction processing processes
 | 
			
		||||
@@ -66,7 +72,7 @@ public:
 | 
			
		||||
        util::Config const& config,
 | 
			
		||||
        boost::asio::io_context& ioContext,
 | 
			
		||||
        std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<NetworkValidatedLedgers> nwvl);
 | 
			
		||||
 | 
			
		||||
    static std::shared_ptr<LoadBalancer>
 | 
			
		||||
@@ -74,7 +80,7 @@ public:
 | 
			
		||||
        util::Config const& config,
 | 
			
		||||
        boost::asio::io_context& ioc,
 | 
			
		||||
        std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<NetworkValidatedLedgers> validatedLedgers);
 | 
			
		||||
 | 
			
		||||
    static std::unique_ptr<Source>
 | 
			
		||||
@@ -82,7 +88,7 @@ public:
 | 
			
		||||
        util::Config const& config,
 | 
			
		||||
        boost::asio::io_context& ioContext,
 | 
			
		||||
        std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<NetworkValidatedLedgers> networkValidatedLedgers,
 | 
			
		||||
        LoadBalancer& balancer);
 | 
			
		||||
 | 
			
		||||
@@ -159,3 +165,4 @@ private:
 | 
			
		||||
    bool
 | 
			
		||||
    execute(Func f, uint32_t ledgerSequence);
 | 
			
		||||
};
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -27,6 +27,8 @@
 | 
			
		||||
#include <data/Types.h>
 | 
			
		||||
#include <fmt/core.h>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
 | 
			
		||||
getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
 | 
			
		||||
{
 | 
			
		||||
@@ -338,3 +340,4 @@ getNFTDataFromObj(std::uint32_t const seq, std::string const& key, std::string c
 | 
			
		||||
 | 
			
		||||
    return nfts;
 | 
			
		||||
}
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -24,6 +24,8 @@
 | 
			
		||||
#include <ripple/protocol/STTx.h>
 | 
			
		||||
#include <ripple/protocol/TxMeta.h>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Pull NFT data from TX via ETLService
 | 
			
		||||
 */
 | 
			
		||||
@@ -35,3 +37,5 @@ getNFTDataFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
 | 
			
		||||
 */
 | 
			
		||||
std::vector<NFTsData>
 | 
			
		||||
getNFTDataFromObj(std::uint32_t const seq, std::string const& key, std::string const& blob);
 | 
			
		||||
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -19,11 +19,13 @@
 | 
			
		||||
 | 
			
		||||
#include <etl/ProbingSource.h>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
ProbingSource::ProbingSource(
 | 
			
		||||
    util::Config const& config,
 | 
			
		||||
    boost::asio::io_context& ioc,
 | 
			
		||||
    std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
    std::shared_ptr<NetworkValidatedLedgers> nwvl,
 | 
			
		||||
    LoadBalancer& balancer,
 | 
			
		||||
    boost::asio::ssl::context sslCtx)
 | 
			
		||||
@@ -197,3 +199,4 @@ ProbingSource::make_PlainHooks() noexcept
 | 
			
		||||
                return SourceHooks::Action::STOP;
 | 
			
		||||
            }};
 | 
			
		||||
};
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -31,6 +31,8 @@
 | 
			
		||||
 | 
			
		||||
#include <mutex>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief This Source implementation attempts to connect over both secure websocket and plain websocket.
 | 
			
		||||
 *
 | 
			
		||||
@@ -68,7 +70,7 @@ public:
 | 
			
		||||
        util::Config const& config,
 | 
			
		||||
        boost::asio::io_context& ioc,
 | 
			
		||||
        std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<NetworkValidatedLedgers> nwvl,
 | 
			
		||||
        LoadBalancer& balancer,
 | 
			
		||||
        boost::asio::ssl::context sslCtx = boost::asio::ssl::context{boost::asio::ssl::context::tlsv12});
 | 
			
		||||
@@ -122,3 +124,4 @@ private:
 | 
			
		||||
    SourceHooks
 | 
			
		||||
    make_PlainHooks() noexcept;
 | 
			
		||||
};
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -34,6 +34,8 @@
 | 
			
		||||
 | 
			
		||||
#include <thread>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
static boost::beast::websocket::stream_base::timeout
 | 
			
		||||
make_TimeoutOption()
 | 
			
		||||
{
 | 
			
		||||
@@ -191,3 +193,4 @@ SslSource::onSslHandshake(
 | 
			
		||||
        ws().async_handshake(host, "/", [this](auto ec) { onHandshake(ec); });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -24,7 +24,7 @@
 | 
			
		||||
#include <etl/LoadBalancer.h>
 | 
			
		||||
#include <etl/impl/AsyncData.h>
 | 
			
		||||
#include <etl/impl/ForwardCache.h>
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
 | 
			
		||||
@@ -40,7 +40,9 @@
 | 
			
		||||
#include <grpcpp/grpcpp.h>
 | 
			
		||||
 | 
			
		||||
class ProbingSource;
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TODO: we use Source so that we can store a vector of Sources
 | 
			
		||||
// but we also use CRTP for implementation of the common logic - this is a bit strange because CRTP as used here is
 | 
			
		||||
@@ -48,6 +50,8 @@ class SubscriptionManager;
 | 
			
		||||
// Maybe we should rework this a bit. At this point there is not too much use in the CRTP implementation - we can move
 | 
			
		||||
// things into the base class instead.
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Base class for all ETL sources
 | 
			
		||||
 */
 | 
			
		||||
@@ -145,7 +149,7 @@ class SourceImpl : public Source
 | 
			
		||||
    mutable std::mutex lastMsgTimeMtx_;
 | 
			
		||||
 | 
			
		||||
    std::shared_ptr<BackendInterface> backend_;
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subscriptions_;
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subscriptions_;
 | 
			
		||||
    LoadBalancer& balancer_;
 | 
			
		||||
 | 
			
		||||
    etl::detail::ForwardCache forwardCache_;
 | 
			
		||||
@@ -179,7 +183,7 @@ public:
 | 
			
		||||
        util::Config const& config,
 | 
			
		||||
        boost::asio::io_context& ioContext,
 | 
			
		||||
        std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<NetworkValidatedLedgers> networkValidatedLedgers,
 | 
			
		||||
        LoadBalancer& balancer,
 | 
			
		||||
        SourceHooks hooks)
 | 
			
		||||
@@ -839,7 +843,7 @@ public:
 | 
			
		||||
        util::Config const& config,
 | 
			
		||||
        boost::asio::io_context& ioc,
 | 
			
		||||
        std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<NetworkValidatedLedgers> nwvl,
 | 
			
		||||
        LoadBalancer& balancer,
 | 
			
		||||
        SourceHooks hooks)
 | 
			
		||||
@@ -880,7 +884,7 @@ public:
 | 
			
		||||
        boost::asio::io_context& ioc,
 | 
			
		||||
        std::optional<std::reference_wrapper<boost::asio::ssl::context>> sslCtx,
 | 
			
		||||
        std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<NetworkValidatedLedgers> nwvl,
 | 
			
		||||
        LoadBalancer& balancer,
 | 
			
		||||
        SourceHooks hooks)
 | 
			
		||||
@@ -915,3 +919,4 @@ public:
 | 
			
		||||
        return *ws_;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
@@ -21,6 +21,8 @@
 | 
			
		||||
 | 
			
		||||
#include <atomic>
 | 
			
		||||
 | 
			
		||||
namespace etl {
 | 
			
		||||
 | 
			
		||||
struct SystemState
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
@@ -53,3 +55,4 @@ struct SystemState
 | 
			
		||||
     */
 | 
			
		||||
    std::atomic_bool isAmendmentBlocked = false;
 | 
			
		||||
};
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,7 @@ class ForwardCache
 | 
			
		||||
    mutable std::shared_mutex mtx_;
 | 
			
		||||
    std::unordered_map<std::string, ResponseType> latestForwarded_;
 | 
			
		||||
    boost::asio::strand<boost::asio::io_context::executor_type> strand_;
 | 
			
		||||
    ::Source const& source_;
 | 
			
		||||
    etl::Source const& source_;
 | 
			
		||||
    std::uint32_t duration_ = 10;
 | 
			
		||||
 | 
			
		||||
    void
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ public:
 | 
			
		||||
    LedgerPublisher(
 | 
			
		||||
        boost::asio::io_context& ioc,
 | 
			
		||||
        std::shared_ptr<BackendInterface> backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> subscriptions,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> subscriptions,
 | 
			
		||||
        SystemState const& state)
 | 
			
		||||
        : publishStrand_{boost::asio::make_strand(ioc)}
 | 
			
		||||
        , backend_{backend}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,7 @@
 | 
			
		||||
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
namespace feed {
 | 
			
		||||
// This class should only be constructed once, then it can
 | 
			
		||||
// be read from in parallel by many websocket senders
 | 
			
		||||
class Message
 | 
			
		||||
@@ -54,3 +55,5 @@ public:
 | 
			
		||||
        return message_.size();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}  // namespace feed
 | 
			
		||||
@@ -17,9 +17,11 @@
 | 
			
		||||
*/
 | 
			
		||||
//==============================================================================
 | 
			
		||||
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
#include <rpc/BookChangesHelper.h>
 | 
			
		||||
#include <rpc/RPCHelpers.h>
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
 | 
			
		||||
namespace feed {
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Subscription::subscribe(SessionPtrType const& session)
 | 
			
		||||
@@ -364,3 +366,5 @@ SubscriptionManager::cleanup(SessionPtrType session)
 | 
			
		||||
 | 
			
		||||
    cleanupFuncs_.erase(session);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}  // namespace feed
 | 
			
		||||
@@ -22,12 +22,14 @@
 | 
			
		||||
#include <data/BackendInterface.h>
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
#include <ripple/protocol/LedgerHeader.h>
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
namespace feed {
 | 
			
		||||
 | 
			
		||||
using SessionPtrType = std::shared_ptr<web::ConnectionBase>;
 | 
			
		||||
 | 
			
		||||
class Subscription
 | 
			
		||||
@@ -369,3 +371,5 @@ private:
 | 
			
		||||
    std::mutex cleanupMtx_;
 | 
			
		||||
    std::unordered_map<SessionPtrType, std::vector<CleanupFunction>> cleanupFuncs_ = {};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}  // namespace feed
 | 
			
		||||
@@ -31,8 +31,8 @@
 | 
			
		||||
#include <rpc/RPCEngine.h>
 | 
			
		||||
#include <rpc/common/impl/HandlerProvider.h>
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <webserver/RPCServerHandler.h>
 | 
			
		||||
#include <webserver/Server.h>
 | 
			
		||||
#include <web/RPCServerHandler.h>
 | 
			
		||||
#include <web/Server.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
 | 
			
		||||
#include <boost/filesystem/path.hpp>
 | 
			
		||||
@@ -187,19 +187,19 @@ try
 | 
			
		||||
    auto backend = data::make_Backend(ioc, config);
 | 
			
		||||
 | 
			
		||||
    // Manages clients subscribed to streams
 | 
			
		||||
    auto subscriptions = SubscriptionManager::make_SubscriptionManager(config, backend);
 | 
			
		||||
    auto subscriptions = feed::SubscriptionManager::make_SubscriptionManager(config, backend);
 | 
			
		||||
 | 
			
		||||
    // Tracks which ledgers have been validated by the network
 | 
			
		||||
    auto ledgers = NetworkValidatedLedgers::make_ValidatedLedgers();
 | 
			
		||||
    auto ledgers = etl::NetworkValidatedLedgers::make_ValidatedLedgers();
 | 
			
		||||
 | 
			
		||||
    // Handles the connection to one or more rippled nodes.
 | 
			
		||||
    // ETL uses the balancer to extract data.
 | 
			
		||||
    // The server uses the balancer to forward RPCs to a rippled node.
 | 
			
		||||
    // The balancer itself publishes to streams (transactions_proposed and accounts_proposed)
 | 
			
		||||
    auto balancer = LoadBalancer::make_LoadBalancer(config, ioc, backend, subscriptions, ledgers);
 | 
			
		||||
    auto balancer = etl::LoadBalancer::make_LoadBalancer(config, ioc, backend, subscriptions, ledgers);
 | 
			
		||||
 | 
			
		||||
    // ETL is responsible for writing and publishing to streams. In read-only mode, ETL only publishes
 | 
			
		||||
    auto etl = ETLService::make_ETLService(config, ioc, backend, subscriptions, balancer, ledgers);
 | 
			
		||||
    auto etl = etl::ETLService::make_ETLService(config, ioc, backend, subscriptions, balancer, ledgers);
 | 
			
		||||
 | 
			
		||||
    auto workQueue = WorkQueue::make_WorkQueue(config);
 | 
			
		||||
    auto counters = RPC::Counters::make_Counters(workQueue);
 | 
			
		||||
@@ -209,8 +209,8 @@ try
 | 
			
		||||
        config, backend, subscriptions, balancer, etl, dosGuard, workQueue, counters, handlerProvider);
 | 
			
		||||
 | 
			
		||||
    // init the web server
 | 
			
		||||
    auto handler =
 | 
			
		||||
        std::make_shared<RPCServerHandler<RPC::RPCEngine, ETLService>>(config, backend, rpcEngine, etl, subscriptions);
 | 
			
		||||
    auto handler = std::make_shared<RPCServerHandler<RPC::RPCEngine, etl::ETLService>>(
 | 
			
		||||
        config, backend, rpcEngine, etl, subscriptions);
 | 
			
		||||
    auto ctx = parseCerts(config);
 | 
			
		||||
    auto const ctxRef = ctx ? std::optional<std::reference_wrapper<ssl::context>>{ctx.value()} : std::nullopt;
 | 
			
		||||
    auto const httpServer = web::make_HttpServer(config, ioc, ctxRef, dosGuard, handler);
 | 
			
		||||
 
 | 
			
		||||
@@ -23,8 +23,8 @@
 | 
			
		||||
#include <rpc/Errors.h>
 | 
			
		||||
#include <rpc/common/APIVersion.h>
 | 
			
		||||
#include <util/Expected.h>
 | 
			
		||||
#include <webserver/Context.h>
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/Context.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/asio/spawn.hpp>
 | 
			
		||||
#include <boost/json.hpp>
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,8 @@
 | 
			
		||||
#include <util/Taggable.h>
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
#include <webserver/Context.h>
 | 
			
		||||
#include <webserver/DOSGuard.h>
 | 
			
		||||
#include <web/Context.h>
 | 
			
		||||
#include <web/DOSGuard.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/asio/spawn.hpp>
 | 
			
		||||
#include <boost/json.hpp>
 | 
			
		||||
@@ -43,9 +43,14 @@
 | 
			
		||||
#include <unordered_map>
 | 
			
		||||
#include <variant>
 | 
			
		||||
 | 
			
		||||
// forward declarations
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
namespace etl {
 | 
			
		||||
class LoadBalancer;
 | 
			
		||||
class ETLService;
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
 | 
			
		||||
namespace RPC {
 | 
			
		||||
 | 
			
		||||
@@ -59,23 +64,23 @@ class RPCEngineBase
 | 
			
		||||
    util::Logger log_{"RPC"};
 | 
			
		||||
 | 
			
		||||
    std::shared_ptr<BackendInterface> backend_;
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subscriptions_;
 | 
			
		||||
    std::shared_ptr<LoadBalancer> balancer_;
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subscriptions_;
 | 
			
		||||
    std::shared_ptr<etl::LoadBalancer> balancer_;
 | 
			
		||||
    std::reference_wrapper<web::DOSGuard const> dosGuard_;
 | 
			
		||||
    std::reference_wrapper<WorkQueue> workQueue_;
 | 
			
		||||
    std::reference_wrapper<Counters> counters_;
 | 
			
		||||
 | 
			
		||||
    std::shared_ptr<HandlerProvider const> handlerProvider_;
 | 
			
		||||
 | 
			
		||||
    detail::ForwardingProxy<LoadBalancer, Counters, HandlerProvider> forwardingProxy_;
 | 
			
		||||
    detail::ForwardingProxy<etl::LoadBalancer, Counters, HandlerProvider> forwardingProxy_;
 | 
			
		||||
    AdminVerificationStrategyType adminVerifier_;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    RPCEngineBase(
 | 
			
		||||
        std::shared_ptr<BackendInterface> const& backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> const& subscriptions,
 | 
			
		||||
        std::shared_ptr<LoadBalancer> const& balancer,
 | 
			
		||||
        std::shared_ptr<ETLService> const& etl,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> const& subscriptions,
 | 
			
		||||
        std::shared_ptr<etl::LoadBalancer> const& balancer,
 | 
			
		||||
        std::shared_ptr<etl::ETLService> const& etl,
 | 
			
		||||
        web::DOSGuard const& dosGuard,
 | 
			
		||||
        WorkQueue& workQueue,
 | 
			
		||||
        Counters& counters,
 | 
			
		||||
@@ -95,9 +100,9 @@ public:
 | 
			
		||||
    make_RPCEngine(
 | 
			
		||||
        util::Config const& config,
 | 
			
		||||
        std::shared_ptr<BackendInterface> const& backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> const& subscriptions,
 | 
			
		||||
        std::shared_ptr<LoadBalancer> const& balancer,
 | 
			
		||||
        std::shared_ptr<ETLService> const& etl,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> const& subscriptions,
 | 
			
		||||
        std::shared_ptr<etl::LoadBalancer> const& balancer,
 | 
			
		||||
        std::shared_ptr<etl::ETLService> const& etl,
 | 
			
		||||
        web::DOSGuard const& dosGuard,
 | 
			
		||||
        WorkQueue& workQueue,
 | 
			
		||||
        Counters& counters,
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@
 | 
			
		||||
#include <rpc/JS.h>
 | 
			
		||||
#include <rpc/common/Types.h>
 | 
			
		||||
#include <util/JsonUtils.h>
 | 
			
		||||
#include <webserver/Context.h>
 | 
			
		||||
#include <web/Context.h>
 | 
			
		||||
 | 
			
		||||
#include <ripple/protocol/Indexes.h>
 | 
			
		||||
#include <ripple/protocol/Rate.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -28,12 +28,13 @@
 | 
			
		||||
#include <boost/json/value.hpp>
 | 
			
		||||
#include <boost/json/value_from.hpp>
 | 
			
		||||
 | 
			
		||||
class LoadBalancer;
 | 
			
		||||
namespace web {
 | 
			
		||||
struct ConnectionBase;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class LoadBalancer;
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace RPC {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@
 | 
			
		||||
#include <rpc/RPCHelpers.h>
 | 
			
		||||
#include <rpc/common/Types.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
#include <webserver/Context.h>
 | 
			
		||||
#include <web/Context.h>
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <string>
 | 
			
		||||
 
 | 
			
		||||
@@ -20,8 +20,8 @@
 | 
			
		||||
#include <rpc/common/impl/HandlerProvider.h>
 | 
			
		||||
 | 
			
		||||
#include <etl/ETLService.h>
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
#include <rpc/Counters.h>
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
 | 
			
		||||
#include <rpc/handlers/AccountChannels.h>
 | 
			
		||||
#include <rpc/handlers/AccountCurrencies.h>
 | 
			
		||||
@@ -58,9 +58,9 @@ namespace RPC::detail {
 | 
			
		||||
ProductionHandlerProvider::ProductionHandlerProvider(
 | 
			
		||||
    util::Config const& config,
 | 
			
		||||
    std::shared_ptr<BackendInterface> const& backend,
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> const& subscriptionManager,
 | 
			
		||||
    std::shared_ptr<LoadBalancer> const& balancer,
 | 
			
		||||
    std::shared_ptr<ETLService const> const& etl,
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> const& subscriptionManager,
 | 
			
		||||
    std::shared_ptr<etl::LoadBalancer> const& balancer,
 | 
			
		||||
    std::shared_ptr<etl::ETLService const> const& etl,
 | 
			
		||||
    Counters const& counters)
 | 
			
		||||
    : handlerMap_{
 | 
			
		||||
          {"account_channels", {AccountChannelsHandler{backend}}},
 | 
			
		||||
 
 | 
			
		||||
@@ -20,21 +20,24 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <data/BackendInterface.h>
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
#include <rpc/common/AnyHandler.h>
 | 
			
		||||
#include <rpc/common/Types.h>
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
 | 
			
		||||
#include <optional>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <unordered_map>
 | 
			
		||||
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
namespace etl {
 | 
			
		||||
class ETLService;
 | 
			
		||||
class LoadBalancer;
 | 
			
		||||
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
namespace RPC {
 | 
			
		||||
class Counters;
 | 
			
		||||
}
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace RPC::detail {
 | 
			
		||||
 | 
			
		||||
@@ -52,9 +55,9 @@ public:
 | 
			
		||||
    ProductionHandlerProvider(
 | 
			
		||||
        util::Config const& config,
 | 
			
		||||
        std::shared_ptr<BackendInterface> const& backend,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> const& subscriptionManager,
 | 
			
		||||
        std::shared_ptr<LoadBalancer> const& balancer,
 | 
			
		||||
        std::shared_ptr<ETLService const> const& etl,
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> const& subscriptionManager,
 | 
			
		||||
        std::shared_ptr<etl::LoadBalancer> const& balancer,
 | 
			
		||||
        std::shared_ptr<etl::ETLService const> const& etl,
 | 
			
		||||
        Counters const& counters);
 | 
			
		||||
 | 
			
		||||
    bool
 | 
			
		||||
 
 | 
			
		||||
@@ -32,10 +32,13 @@
 | 
			
		||||
#include <chrono>
 | 
			
		||||
#include <fmt/core.h>
 | 
			
		||||
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
namespace etl {
 | 
			
		||||
class ETLService;
 | 
			
		||||
class LoadBalancer;
 | 
			
		||||
 | 
			
		||||
}  // namespace etl
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
namespace RPC {
 | 
			
		||||
class Counters;
 | 
			
		||||
}
 | 
			
		||||
@@ -252,6 +255,7 @@ private:
 | 
			
		||||
 *
 | 
			
		||||
 * For more details see: https://xrpl.org/server_info-clio.html
 | 
			
		||||
 */
 | 
			
		||||
using ServerInfoHandler = BaseServerInfoHandler<SubscriptionManager, LoadBalancer, ETLService, Counters>;
 | 
			
		||||
using ServerInfoHandler =
 | 
			
		||||
    BaseServerInfoHandler<feed::SubscriptionManager, etl::LoadBalancer, etl::ETLService, Counters>;
 | 
			
		||||
 | 
			
		||||
}  // namespace RPC
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,10 @@
 | 
			
		||||
#include <rpc/common/Types.h>
 | 
			
		||||
#include <rpc/common/Validators.h>
 | 
			
		||||
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace RPC {
 | 
			
		||||
template <typename SubscriptionManagerType>
 | 
			
		||||
class BaseSubscribeHandler
 | 
			
		||||
@@ -318,6 +322,6 @@ private:
 | 
			
		||||
 *
 | 
			
		||||
 * For more details see: https://xrpl.org/subscribe.html
 | 
			
		||||
 */
 | 
			
		||||
using SubscribeHandler = BaseSubscribeHandler<SubscriptionManager>;
 | 
			
		||||
using SubscribeHandler = BaseSubscribeHandler<feed::SubscriptionManager>;
 | 
			
		||||
 | 
			
		||||
}  // namespace RPC
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,10 @@
 | 
			
		||||
#include <rpc/common/Types.h>
 | 
			
		||||
#include <rpc/common/Validators.h>
 | 
			
		||||
 | 
			
		||||
namespace feed {
 | 
			
		||||
class SubscriptionManager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace RPC {
 | 
			
		||||
 | 
			
		||||
template <typename SubscriptionManagerType>
 | 
			
		||||
@@ -219,6 +223,6 @@ private:
 | 
			
		||||
 *
 | 
			
		||||
 * For more details see: https://xrpl.org/unsubscribe.html
 | 
			
		||||
 */
 | 
			
		||||
using UnsubscribeHandler = BaseUnsubscribeHandler<SubscriptionManager>;
 | 
			
		||||
using UnsubscribeHandler = BaseUnsubscribeHandler<feed::SubscriptionManager>;
 | 
			
		||||
 | 
			
		||||
}  // namespace RPC
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
#include <data/BackendInterface.h>
 | 
			
		||||
#include <util/Taggable.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/asio/spawn.hpp>
 | 
			
		||||
#include <boost/json.hpp>
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <webserver/impl/WhitelistHandler.h>
 | 
			
		||||
#include <web/WhitelistHandler.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/asio.hpp>
 | 
			
		||||
#include <boost/iterator/transform_iterator.hpp>
 | 
			
		||||
@@ -19,8 +19,8 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <webserver/PlainWsSession.h>
 | 
			
		||||
#include <webserver/impl/HttpBase.h>
 | 
			
		||||
#include <web/PlainWsSession.h>
 | 
			
		||||
#include <web/impl/HttpBase.h>
 | 
			
		||||
 | 
			
		||||
namespace web {
 | 
			
		||||
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <webserver/impl/WsBase.h>
 | 
			
		||||
#include <web/impl/WsBase.h>
 | 
			
		||||
 | 
			
		||||
namespace web {
 | 
			
		||||
 | 
			
		||||
@@ -25,7 +25,7 @@
 | 
			
		||||
#include <rpc/common/impl/APIVersionParser.h>
 | 
			
		||||
#include <util/JsonUtils.h>
 | 
			
		||||
#include <util/Profiler.h>
 | 
			
		||||
#include <webserver/impl/ErrorHandling.h>
 | 
			
		||||
#include <web/impl/ErrorHandling.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/json/parse.hpp>
 | 
			
		||||
 | 
			
		||||
@@ -41,7 +41,7 @@ class RPCServerHandler
 | 
			
		||||
    std::shared_ptr<Engine> const rpcEngine_;
 | 
			
		||||
    std::shared_ptr<ETL const> const etl_;
 | 
			
		||||
    // subscription manager holds the shared_ptr of this class
 | 
			
		||||
    std::weak_ptr<SubscriptionManager> const subscriptions_;
 | 
			
		||||
    std::weak_ptr<feed::SubscriptionManager> const subscriptions_;
 | 
			
		||||
    util::TagDecoratorFactory const tagFactory_;
 | 
			
		||||
    RPC::detail::ProductionAPIVersionParser apiVersionParser_;  // can be injected if needed
 | 
			
		||||
 | 
			
		||||
@@ -54,7 +54,7 @@ public:
 | 
			
		||||
        std::shared_ptr<BackendInterface const> const& backend,
 | 
			
		||||
        std::shared_ptr<Engine> const& rpcEngine,
 | 
			
		||||
        std::shared_ptr<ETL const> const& etl,
 | 
			
		||||
        std::shared_ptr<SubscriptionManager> const& subscriptions)
 | 
			
		||||
        std::shared_ptr<feed::SubscriptionManager> const& subscriptions)
 | 
			
		||||
        : backend_(backend)
 | 
			
		||||
        , rpcEngine_(rpcEngine)
 | 
			
		||||
        , etl_(etl)
 | 
			
		||||
@@ -20,9 +20,9 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
#include <webserver/HttpSession.h>
 | 
			
		||||
#include <webserver/SslHttpSession.h>
 | 
			
		||||
#include <webserver/interface/Concepts.h>
 | 
			
		||||
#include <web/HttpSession.h>
 | 
			
		||||
#include <web/SslHttpSession.h>
 | 
			
		||||
#include <web/interface/Concepts.h>
 | 
			
		||||
 | 
			
		||||
#include <fmt/core.h>
 | 
			
		||||
 | 
			
		||||
@@ -19,8 +19,8 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <webserver/SslWsSession.h>
 | 
			
		||||
#include <webserver/impl/HttpBase.h>
 | 
			
		||||
#include <web/SslWsSession.h>
 | 
			
		||||
#include <web/impl/HttpBase.h>
 | 
			
		||||
 | 
			
		||||
namespace web {
 | 
			
		||||
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <webserver/impl/WsBase.h>
 | 
			
		||||
#include <web/impl/WsBase.h>
 | 
			
		||||
 | 
			
		||||
namespace web {
 | 
			
		||||
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <rpc/Errors.h>
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/beast/http.hpp>
 | 
			
		||||
#include <boost/json.hpp>
 | 
			
		||||
@@ -21,9 +21,9 @@
 | 
			
		||||
 | 
			
		||||
#include <main/Build.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
#include <webserver/DOSGuard.h>
 | 
			
		||||
#include <webserver/interface/Concepts.h>
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/DOSGuard.h>
 | 
			
		||||
#include <web/interface/Concepts.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/beast/core.hpp>
 | 
			
		||||
#include <boost/beast/http.hpp>
 | 
			
		||||
@@ -21,9 +21,9 @@
 | 
			
		||||
 | 
			
		||||
#include <rpc/common/Types.h>
 | 
			
		||||
#include <util/log/Logger.h>
 | 
			
		||||
#include <webserver/DOSGuard.h>
 | 
			
		||||
#include <webserver/interface/Concepts.h>
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/DOSGuard.h>
 | 
			
		||||
#include <web/interface/Concepts.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/beast/core.hpp>
 | 
			
		||||
#include <boost/beast/websocket.hpp>
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/beast.hpp>
 | 
			
		||||
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
#include <util/Fixtures.h>
 | 
			
		||||
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <webserver/DOSGuard.h>
 | 
			
		||||
#include <web/DOSGuard.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/json/parse.hpp>
 | 
			
		||||
#include <gmock/gmock.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@
 | 
			
		||||
*/
 | 
			
		||||
//==============================================================================
 | 
			
		||||
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
#include <util/Fixtures.h>
 | 
			
		||||
#include <util/MockBackend.h>
 | 
			
		||||
#include <util/MockWsBase.h>
 | 
			
		||||
@@ -60,7 +60,7 @@ TEST(SubscriptionManagerTest, InitAndReport)
 | 
			
		||||
    })";
 | 
			
		||||
    util::Config cfg;
 | 
			
		||||
    auto backend = std::make_shared<MockBackend>(cfg);
 | 
			
		||||
    auto subManager = SubscriptionManager::make_SubscriptionManager(cfg, backend);
 | 
			
		||||
    auto subManager = feed::SubscriptionManager::make_SubscriptionManager(cfg, backend);
 | 
			
		||||
    EXPECT_EQ(subManager->report(), json::parse(ReportReturn));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -84,14 +84,14 @@ class SubscriptionManagerSimpleBackendTest : public MockBackendTest
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
    util::Config cfg;
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subManagerPtr;
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subManagerPtr;
 | 
			
		||||
    util::TagDecoratorFactory tagDecoratorFactory{cfg};
 | 
			
		||||
    std::shared_ptr<web::ConnectionBase> session;
 | 
			
		||||
    void
 | 
			
		||||
    SetUp() override
 | 
			
		||||
    {
 | 
			
		||||
        MockBackendTest::SetUp();
 | 
			
		||||
        subManagerPtr = SubscriptionManager::make_SubscriptionManager(cfg, mockBackendPtr);
 | 
			
		||||
        subManagerPtr = feed::SubscriptionManager::make_SubscriptionManager(cfg, mockBackendPtr);
 | 
			
		||||
        session = std::make_shared<MockSession>(tagDecoratorFactory);
 | 
			
		||||
    }
 | 
			
		||||
    void
 | 
			
		||||
 
 | 
			
		||||
@@ -17,8 +17,8 @@
 | 
			
		||||
*/
 | 
			
		||||
//==============================================================================
 | 
			
		||||
 | 
			
		||||
#include <subscriptions/Message.h>
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
#include <feed/Message.h>
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
 | 
			
		||||
#include <util/Fixtures.h>
 | 
			
		||||
#include <util/MockWsBase.h>
 | 
			
		||||
@@ -27,6 +27,7 @@
 | 
			
		||||
#include <gmock/gmock.h>
 | 
			
		||||
 | 
			
		||||
namespace json = boost::json;
 | 
			
		||||
using namespace feed;
 | 
			
		||||
 | 
			
		||||
TEST(MessageTest, Message)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -363,7 +363,7 @@ TEST_F(BackendCassandraTest, Basic)
 | 
			
		||||
            ripple::TxMeta nftTxMeta{nftHash256, lgrInfoNext.seq, nftTxnMetaBlob};
 | 
			
		||||
            ripple::SerialIter it{nftTxnBlob.data(), nftTxnBlob.size()};
 | 
			
		||||
            ripple::STTx sttx{it};
 | 
			
		||||
            auto const [parsedNFTTxsRef, parsedNFT] = getNFTDataFromTx(nftTxMeta, sttx);
 | 
			
		||||
            auto const [parsedNFTTxsRef, parsedNFT] = etl::getNFTDataFromTx(nftTxMeta, sttx);
 | 
			
		||||
            // need to copy the nft txns so we can std::move later
 | 
			
		||||
            std::vector<NFTTransactionsData> parsedNFTTxs;
 | 
			
		||||
            parsedNFTTxs.insert(parsedNFTTxs.end(), parsedNFTTxsRef.begin(), parsedNFTTxsRef.end());
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
using namespace testing;
 | 
			
		||||
using namespace etl;
 | 
			
		||||
 | 
			
		||||
class ETLExtractorTest : public NoLoggerFixture
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
using namespace testing;
 | 
			
		||||
using namespace etl;
 | 
			
		||||
 | 
			
		||||
// taken from BackendTests
 | 
			
		||||
constexpr static auto RAW_HEADER =
 | 
			
		||||
 
 | 
			
		||||
@@ -17,9 +17,9 @@
 | 
			
		||||
*/
 | 
			
		||||
//==============================================================================
 | 
			
		||||
 | 
			
		||||
#include <feed/SubscriptionManager.h>
 | 
			
		||||
#include <rpc/common/AnyHandler.h>
 | 
			
		||||
#include <rpc/handlers/Subscribe.h>
 | 
			
		||||
#include <subscriptions/SubscriptionManager.h>
 | 
			
		||||
#include <util/Fixtures.h>
 | 
			
		||||
#include <util/MockWsBase.h>
 | 
			
		||||
#include <util/TestObject.h>
 | 
			
		||||
@@ -51,7 +51,7 @@ protected:
 | 
			
		||||
    {
 | 
			
		||||
        HandlerBaseTest::SetUp();
 | 
			
		||||
        util::Config cfg;
 | 
			
		||||
        subManager_ = SubscriptionManager::make_SubscriptionManager(cfg, mockBackendPtr);
 | 
			
		||||
        subManager_ = feed::SubscriptionManager::make_SubscriptionManager(cfg, mockBackendPtr);
 | 
			
		||||
        util::TagDecoratorFactory tagDecoratorFactory{cfg};
 | 
			
		||||
        session_ = std::make_shared<MockSession>(tagDecoratorFactory);
 | 
			
		||||
    }
 | 
			
		||||
@@ -61,7 +61,7 @@ protected:
 | 
			
		||||
        HandlerBaseTest::TearDown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subManager_;
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subManager_;
 | 
			
		||||
    std::shared_ptr<web::ConnectionBase> session_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@
 | 
			
		||||
using namespace RPC;
 | 
			
		||||
namespace json = boost::json;
 | 
			
		||||
using namespace testing;
 | 
			
		||||
using namespace feed;
 | 
			
		||||
 | 
			
		||||
using TestUnsubscribeHandler = BaseUnsubscribeHandler<MockSubscriptionManager>;
 | 
			
		||||
 | 
			
		||||
@@ -54,7 +55,7 @@ protected:
 | 
			
		||||
        HandlerBaseTest::TearDown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    std::shared_ptr<SubscriptionManager> subManager_;
 | 
			
		||||
    std::shared_ptr<feed::SubscriptionManager> subManager_;
 | 
			
		||||
    std::shared_ptr<web::ConnectionBase> session_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
#include <rpc/Factories.h>
 | 
			
		||||
#include <rpc/common/Specs.h>
 | 
			
		||||
#include <rpc/common/Validators.h>
 | 
			
		||||
#include <webserver/DOSGuard.h>
 | 
			
		||||
#include <web/DOSGuard.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/json/value.hpp>
 | 
			
		||||
#include <boost/json/value_from.hpp>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <rpc/common/Types.h>
 | 
			
		||||
#include <webserver/Context.h>
 | 
			
		||||
#include <web/Context.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/asio.hpp>
 | 
			
		||||
#include <gtest/gtest.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/asio/spawn.hpp>
 | 
			
		||||
#include <boost/json.hpp>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <webserver/interface/ConnectionBase.h>
 | 
			
		||||
#include <web/interface/ConnectionBase.h>
 | 
			
		||||
 | 
			
		||||
struct MockSession : public web::ConnectionBase
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -19,12 +19,13 @@
 | 
			
		||||
#include <util/Fixtures.h>
 | 
			
		||||
#include <util/MockETLService.h>
 | 
			
		||||
#include <util/MockRPCEngine.h>
 | 
			
		||||
#include <webserver/RPCServerHandler.h>
 | 
			
		||||
#include <web/RPCServerHandler.h>
 | 
			
		||||
 | 
			
		||||
#include <chrono>
 | 
			
		||||
#include <gtest/gtest.h>
 | 
			
		||||
 | 
			
		||||
using namespace std::chrono_literals;
 | 
			
		||||
using namespace feed;
 | 
			
		||||
 | 
			
		||||
constexpr static auto MINSEQ = 10;
 | 
			
		||||
constexpr static auto MAXSEQ = 30;
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
 | 
			
		||||
#include <util/Fixtures.h>
 | 
			
		||||
#include <util/TestHttpSyncClient.h>
 | 
			
		||||
#include <webserver/Server.h>
 | 
			
		||||
#include <web/Server.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/json/parse.hpp>
 | 
			
		||||
#include <fmt/core.h>
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
#include <rpc/handlers/impl/FakesAndMocks.h>
 | 
			
		||||
#include <util/Fixtures.h>
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <webserver/DOSGuard.h>
 | 
			
		||||
#include <web/DOSGuard.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/json/parse.hpp>
 | 
			
		||||
#include <gmock/gmock.h>
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
//==============================================================================
 | 
			
		||||
#include <util/Fixtures.h>
 | 
			
		||||
#include <util/config/Config.h>
 | 
			
		||||
#include <webserver/DOSGuard.h>
 | 
			
		||||
#include <web/DOSGuard.h>
 | 
			
		||||
 | 
			
		||||
#include <boost/json/parse.hpp>
 | 
			
		||||
#include <gmock/gmock.h>
 | 
			
		||||
		Reference in New Issue
	
	Block a user