CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
28 namespace catapult {
namespace tools {
31 template<
typename TNodeInfo>
46 std::string
name() const override final {
51 optionsBuilder(
"resources,r",
53 "the path to the resources directory");
54 positional.add(
"resources", -1);
63 std::vector<NodeInfoFuture> nodeInfoFutures;
64 auto addNodeInfoFutures = [
this, &connector, &nodeInfoFutures](
const auto& nodes) {
65 for (
const auto& node : nodes) {
71 addNodeInfoFutures(p2pNodes);
72 addNodeInfoFutures(apiNodes);
74 auto finalFuture =
thread::when_all(std::move(nodeInfoFutures)).then([
this](
auto&& allFutures) {
75 std::vector<NodeInfoPointer> nodeInfos;
76 for (
auto& nodeInfoFuture : allFutures.get())
77 nodeInfos.push_back(nodeInfoFuture.get());
82 auto result = utils::checked_cast<size_t, unsigned int>(finalFuture.get());
83 return std::min(static_cast<int>(result), 255);
88 auto pNodeInfo = std::make_shared<TNodeInfo>(node);
91 auto pIo = ioFuture.
get();
95 return thread::when_all(std::move(infoFutures)).then([pIo, pNodeInfo](
auto&&) {
100 CATAPULT_LOG(error) << node <<
" appears to be offline";
111 TNodeInfo& nodeInfo) = 0;
114 virtual size_t processNodeInfos(
const std::vector<NodeInfoPointer>& nodeInfos) = 0;
DEFINE_STATEFUL_VALIDATOR(EligibleHarvester, [](const auto ¬ification, const auto &context) { cache::ImportanceView view(context.Cache.template sub< cache::AccountStateCache >());return view.canHarvest(notification.Signer, context.Height) ? ValidationResult::Success :Failure_Core_Block_Harvester_Ineligible;})
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
T get()
Returns the result of this future and blocks until the result is available.
Definition: Future.h:50
def debug(*args)
Definition: Parser.py:46
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
auto compose(future< TSeed > &&startFuture, TCreateNextFuture createNextFuture)
Definition: FutureUtils.h:102
Represents a thread pool that shares a single io context across multiple threads.
Definition: IoThreadPool.h:30
future< std::vector< future< T > > > when_all(std::vector< future< T >> &&allFutures)
Returns a future that is signaled when all futures in allFutures complete.
Definition: FutureUtils.h:31
An interface for reading and writing packets.
Definition: PacketIo.h:31
Provides a way to access the result of an asynchronous operation.
Definition: Future.h:29
future< T > make_ready_future(T &&value)
Produces a future that is ready immediately and holds the given value.
Definition: Future.h:126
Definition: AddressExtractionExtension.cpp:28
A node in the catapult network.
Definition: Node.h:82