CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
28 namespace catapult {
namespace extensions {
33 template<
typename TRemoteApi,
typename TRemoteApiFactory>
36 TRemoteApiFactory remoteApiFactory,
39 const std::string& taskName) {
40 auto syncTimeout = state.
config().Node.SyncTimeout;
43 auto syncHandler = [&nodes = state.
nodes()](
auto&& future) {
44 auto result = future.get();
49 return [forwarder, syncHandler, synchronizer, remoteApiFactory]() {
50 return forwarder.processSync(synchronizer, remoteApiFactory).then(syncHandler);
57 template<
typename TRemoteApi,
typename TRemoteApiFactory>
60 TRemoteApiFactory remoteApiFactory,
63 const std::string& taskName) {
64 const auto& chainSynced = state.
hooks().chainSyncedPredicate();
66 return [chainSynced, synchronize]() {
supplier< thread::future< TaskResult > > TaskCallback
Task callback that is invoked by the scheduler.
Definition: Task.h:39
std::function< thread::future< ionet::NodeInteractionResultCode >(const TRemoteApi &)> RemoteNodeSynchronizer
Function signature for synchronizing with a remote node.
Definition: RemoteNodeSynchronizer.h:30
thread::TaskCallback CreateSynchronizerTaskCallback(chain::RemoteNodeSynchronizer< TRemoteApi > &&synchronizer, TRemoteApiFactory remoteApiFactory, net::PacketIoPicker &packetIoPicker, const extensions::ServiceState &state, const std::string &taskName)
Definition: SynchronizerTaskCallbacks.h:34
void IncrementNodeInteraction(ionet::NodeContainer &nodes, const ionet::NodeInteractionResult &result)
Increments the interaction counter indicated by result in the node container (nodes).
Definition: NodeInteractionUtils.cpp:27
thread::TaskCallback CreateChainSyncAwareSynchronizerTaskCallback(chain::RemoteNodeSynchronizer< TRemoteApi > &&synchronizer, TRemoteApiFactory remoteApiFactory, net::PacketIoPicker &packetIoPicker, const extensions::ServiceState &state, const std::string &taskName)
Definition: SynchronizerTaskCallbacks.h:58
const auto & config() const
Gets the config.
Definition: ServiceState.h:89
Simplifies interacting with remote nodes via apis.
Definition: RemoteApiForwarder.h:33
State that is used as part of service registration.
Definition: ServiceState.h:51
auto & nodes() const
Gets the nodes.
Definition: ServiceState.h:94
future< T > make_ready_future(T &&value)
Produces a future that is ready immediately and holds the given value.
Definition: Future.h:126
An interface for picking packet io pairs.
Definition: PacketIoPicker.h:30
const auto & hooks() const
Gets the server hooks.
Definition: ServiceState.h:170
Definition: AddressExtractionExtension.cpp:28
const auto & pluginManager() const
Gets the plugin manager.
Definition: ServiceState.h:150