3#include "cluster/Backend.hpp"
4#include "cluster/CacheLoaderDecider.hpp"
5#include "cluster/Concepts.hpp"
6#include "cluster/Metrics.hpp"
7#include "cluster/WriterDecider.hpp"
8#include "data/BackendInterface.hpp"
9#include "data/LedgerCacheLoadingState.hpp"
10#include "etl/SystemState.hpp"
11#include "etl/WriterState.hpp"
12#include "util/config/ConfigDefinition.hpp"
14#include <boost/asio/cancellation_signal.hpp>
15#include <boost/asio/spawn.hpp>
16#include <boost/asio/strand.hpp>
17#include <boost/asio/thread_pool.hpp>
18#include <boost/uuid/uuid.hpp>
32 boost::asio::thread_pool ctx_{1};
39 static constexpr std::chrono::milliseconds kDEFAULT_READ_INTERVAL{1000};
40 static constexpr std::chrono::milliseconds kDEFAULT_WRITE_INTERVAL{1000};
52 std::shared_ptr<data::BackendInterface> backend,
53 std::unique_ptr<etl::WriterStateInterface> writerState,
54 std::unique_ptr<data::LedgerCacheLoadingStateInterface> cacheLoadingState,
55 std::chrono::steady_clock::duration readInterval = kDEFAULT_READ_INTERVAL,
56 std::chrono::steady_clock::duration writeInterval = kDEFAULT_WRITE_INTERVAL
87 std::unique_ptr<ClusterCommunicationService>
service;
88 std::unique_ptr<data::LedgerCacheLoadingStateInterface const>
107 std::shared_ptr<BackendInterface> backend,
108 std::shared_ptr<etl::SystemState> state
Backend communication handler for cluster state synchronization.
Definition Backend.hpp:37
Decides which node in the cluster should load the ledger cache.
Definition CacheLoaderDecider.hpp:25
void run()
Start the service.
Definition ClusterCommunicationService.cpp:37
static MakeResult make(util::config::ClioConfigDefinition const &config, std::shared_ptr< BackendInterface > backend, std::shared_ptr< etl::SystemState > state)
Factory method: construct the service and return a cache loading state for the caller.
Definition ClusterCommunicationService.cpp:63
void stop()
Stop the service.
Definition ClusterCommunicationService.cpp:57
ClusterCommunicationService(std::shared_ptr< data::BackendInterface > backend, std::unique_ptr< etl::WriterStateInterface > writerState, std::unique_ptr< data::LedgerCacheLoadingStateInterface > cacheLoadingState, std::chrono::steady_clock::duration readInterval=kDEFAULT_READ_INTERVAL, std::chrono::steady_clock::duration writeInterval=kDEFAULT_WRITE_INTERVAL)
Construct a new Cluster Communication Service object.
Definition ClusterCommunicationService.cpp:16
Manages Prometheus metrics for cluster communication and node tracking.
Definition Metrics.hpp:20
Decides which node in the cluster should be the writer based on cluster state.
Definition WriterDecider.hpp:64
All the config data will be stored and extracted from this class.
Definition ConfigDefinition.hpp:31
Tag type for cluster communication service implementations.
Definition Concepts.hpp:13
Result of ClusterCommunicationService::make().
Definition ClusterCommunicationService.hpp:86
std::unique_ptr< data::LedgerCacheLoadingStateInterface const > cacheLoadingState
Clone of cache loading state for use by the cache loader.
Definition ClusterCommunicationService.hpp:89
std::unique_ptr< ClusterCommunicationService > service
The constructed service.
Definition ClusterCommunicationService.hpp:87