CatapultServer  v0.5.0.1 (Elephant)
ScheduledHarvesterTask.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "Harvester.h"
28 #include "catapult/functions.h"
29 
30 namespace catapult { namespace harvesting {
31 
36 
39 
42 
45  };
46 
49  public:
51 
52  public:
54  explicit ScheduledHarvesterTask(const ScheduledHarvesterTaskOptions& options, std::unique_ptr<Harvester>&& pHarvester)
55  : m_harvestingAllowed(options.HarvestingAllowed)
56  , m_lastBlockElementSupplier(options.LastBlockElementSupplier)
57  , m_timeSupplier(options.TimeSupplier)
58  , m_rangeConsumer(options.RangeConsumer)
59  , m_pHarvester(std::move(pHarvester))
61  {}
62 
63  public:
66  void harvest();
67 
68  private:
73  std::unique_ptr<Harvester> m_pHarvester;
74 
75  std::atomic_bool m_isAnyHarvestedBlockPending;
76  };
77 }}
Observers.h
catapult::model::EntityRange::FromEntity
static EntityRange FromEntity(std::unique_ptr< TEntity > &&pEntity)
Creates an entity range around a single entity (pEntity).
Definition: EntityRange.h:292
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
catapult::cache::NamespaceCache
Synchronized cache composed of namespace information.
Definition: NamespaceCache.h:71
Rules.PluginRules.firstIncludeCheck
def firstIncludeCheck(sortedIncludes, pathElements)
Definition: Rules.py:144
catapult::harvesting::ScheduledHarvesterTask::m_harvestingAllowed
const decltype(TaskOptions::HarvestingAllowed) m_harvestingAllowed
Definition: ScheduledHarvesterTask.h:69
Rules.ExtensionRules.firstTestIncludeCheck
def firstTestIncludeCheck(sortedIncludes, pathElements)
Definition: Rules.py:271
NamespaceCache.h
Rules.ExtensionRules.validateCrossIncludes
def validateCrossIncludes(sortedIncludes, pathElements)
Definition: Rules.py:306
Rules.ToolsRules.firstIncludeCheck
def firstIncludeCheck(sortedIncludes, pathElements)
Definition: Rules.py:358
catapult::validators::ValidatorContext::Cache
const cache::ReadOnlyCatapultCache & Cache
Catapult cache.
Definition: ValidatorContext.h:62
Rules.DefaultRules.firstTestIncludeCheck
def firstTestIncludeCheck(sortedIncludes, pathElements)
Definition: Rules.py:73
catapult::predicate
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
ValidatorContext.h
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
Rules.PluginRules.namespaceCheck
def namespaceCheck(nsUnified, fullPath)
Definition: Rules.py:115
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
catapult::model::MosaicPropertyId::Duration
Mosaic duration.
Rules.ToolsRules
Definition: Rules.py:342
Rules.PluginRules
Definition: Rules.py:113
catapult::observers::DEFINE_OBSERVER
DEFINE_OBSERVER(AccountAddress, model::AccountAddressNotification, [](const auto &notification, const auto &context) { DefaultAccountVisitor visitor(context);visitor.visit(notification.Address);})
catapult::harvesting::ScheduledHarvesterTask::m_rangeConsumer
const decltype(TaskOptions::RangeConsumer) m_rangeConsumer
Definition: ScheduledHarvesterTask.h:72
catapult::cache::ReadOnlyCatapultCache::sub
const TCache::CacheReadOnlyType & sub() const
Gets a specific sub cache read-only view.
Definition: ReadOnlyCatapultCache.h:35
MAKE_STATEFUL_VALIDATOR
#define MAKE_STATEFUL_VALIDATOR(NAME, HANDLER)
Definition: ValidatorTypes.h:123
Rules.DefaultRules.namespaceCheck
def namespaceCheck(nsUnified, fullPath)
Definition: Rules.py:40
Rules.ExtensionRules._firstTestIncludeCheckForTestsFile
def _firstTestIncludeCheckForTestsFile(pathElements)
Definition: Rules.py:282
functions.h
catapult::harvesting::ScheduledHarvesterTask::m_isAnyHarvestedBlockPending
std::atomic_bool m_isAnyHarvestedBlockPending
Definition: ScheduledHarvesterTask.h:75
Rules.ExtensionRules.namespaceCheck
def namespaceCheck(nsUnified, fullPath)
Definition: Rules.py:214
catapult::Eternal_Artifact_Duration
constexpr BlockDuration Eternal_Artifact_Duration(0)
Duration of eternal artifact.
catapult::validators::DECLARE_STATEFUL_VALIDATOR
DECLARE_STATEFUL_VALIDATOR(Address, Notification)(model
Definition: AddressValidator.cpp:29
catapult::supplier
std::function< T()> supplier
A (stateless) supplier function.
Definition: functions.h:39
catapult::harvesting::ScheduledHarvesterTask
Class that lets a harvester create a block and supplies the block to a consumer.
Definition: ScheduledHarvesterTask.h:48
Elements.h
catapult::utils::BaseValue< uint64_t, BlockDuration_tag >
catapult::harvesting::ScheduledHarvesterTaskOptions::TimeSupplier
chain::TimeSupplier TimeSupplier
Supplies the current network time.
Definition: ScheduledHarvesterTask.h:41
Rules.Rules
Definition: Rules.py:11
catapult::validators::ValidatorContext
Contextual information passed to stateful validators.
Definition: ValidatorContext.h:32
Rules.DefaultRules.firstIncludeCheck
def firstIncludeCheck(sortedIncludes, pathElements)
Definition: Rules.py:65
Rules.getMajorComponentName
def getMajorComponentName(component)
Definition: Rules.py:18
Rules.ExtensionRules.firstIncludeCheck
def firstIncludeCheck(sortedIncludes, pathElements)
Definition: Rules.py:252
catapult::validators::MAKE_STATELESS_VALIDATOR
for(const auto &name :reservedRootNamespaceNames) reservedRootIds.emplace(model return MAKE_STATELESS_VALIDATOR(NamespaceName,([maxNameSize, reservedRootIds](const auto &notification) { if(maxNameSize< notification.NameSize||!model::IsValidName(notification.NamePtr, notification.NameSize)) return Failure_Namespace_Invalid_Name;auto name=utils::RawString(reinterpret_cast< const char * >(notification.NamePtr), notification.NameSize);if(notification.NamespaceId !=model::GenerateNamespaceId(notification.ParentId, name)) return Failure_Namespace_Name_Id_Mismatch;auto namespaceId=Namespace_Base_Id==notification.ParentId ? notification.NamespaceId :notification.ParentId;if(reservedRootIds.cend() !=reservedRootIds.find(namespaceId)) return Failure_Namespace_Root_Name_Reserved;return ValidationResult::Success;}))
Definition: NamespaceNameValidator.cpp:36
catapult::harvesting::ScheduledHarvesterTask::m_lastBlockElementSupplier
const decltype(TaskOptions::LastBlockElementSupplier) m_lastBlockElementSupplier
Definition: ScheduledHarvesterTask.h:70
HexFormatter.h
catapult::harvesting::ScheduledHarvesterTaskOptions
Options for the harvesting task.
Definition: ScheduledHarvesterTask.h:33
DisruptorTypes.h
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
catapult::harvesting::ScheduledHarvesterTaskOptions::LastBlockElementSupplier
supplier< std::shared_ptr< const model::BlockElement > > LastBlockElementSupplier
Supplies information about the last block of the chain.
Definition: ScheduledHarvesterTask.h:38
constants.h
catapult::harvesting::ScheduledHarvesterTaskOptions::HarvestingAllowed
predicate HarvestingAllowed
Indicates if harvesting is allowed.
Definition: ScheduledHarvesterTask.h:35
Rules.ToolsRules.firstTestIncludeCheck
def firstTestIncludeCheck(sortedIncludes, pathElements)
Definition: Rules.py:370
catapult::harvesting::ScheduledHarvesterTask::m_timeSupplier
const decltype(TaskOptions::TimeSupplier) m_timeSupplier
Definition: ScheduledHarvesterTask.h:71
catapult::harvesting::ScheduledHarvesterTaskOptions::RangeConsumer
consumer< model::BlockRange &&, const disruptor::ProcessingCompleteFunc & > RangeConsumer
Consumes a range consisting of the harvested block, usually delivers it to the disruptor queue.
Definition: ScheduledHarvesterTask.h:44
Validators.h
EntityInfo.h
Rules.DefaultRules.checkCatapultTest
def checkCatapultTest(pathUnified, splittedPath)
Definition: Rules.py:28
Rules.PluginRules.firstTestIncludeCheck
def firstTestIncludeCheck(sortedIncludes, pathElements)
Definition: Rules.py:159
ScheduledHarvesterTask.h
Rules.ToolsRules.namespaceCheck
def namespaceCheck(nsUnified, fullPath)
Definition: Rules.py:344
catapult::validators::ValidationResult::Success
Validation succeeded.
ChainFunctions.h
catapult::chain::TimeSupplier
supplier< Timestamp > TimeSupplier
Supplies a timestamp.
Definition: ChainFunctions.h:39
Rules.ExtensionRules
Definition: Rules.py:212
catapult::validators::DECLARE_STATELESS_VALIDATOR
DECLARE_STATELESS_VALIDATOR(MaxTransactions, Notification)(uint32_t maxTransactions)
Definition: MaxTransactionsValidator.cpp:27
Harvester.h
Rules.DefaultRules
Definition: Rules.py:26
catapult::harvesting::ScheduledHarvesterTask::m_pHarvester
std::unique_ptr< Harvester > m_pHarvester
Definition: ScheduledHarvesterTask.h:73
catapult::harvesting::ScheduledHarvesterTask::harvest
void harvest()
Definition: ScheduledHarvesterTask.cpp:26
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::AccountAddressNotification
Notification of use of an account address.
Definition: Notifications.h:57
Hashers.h
Rules.PluginRules.validateCrossIncludes
def validateCrossIncludes(sortedIncludes, pathElements)
Definition: Rules.py:186
catapult::consumer
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
catapult::harvesting::ScheduledHarvesterTask::ScheduledHarvesterTask
ScheduledHarvesterTask(const ScheduledHarvesterTaskOptions &options, std::unique_ptr< Harvester > &&pHarvester)
Creates a scheduled harvesting task around options and a pHarvester.
Definition: ScheduledHarvesterTask.h:54
RangeTypes.h
Rules.DefaultRules.validateCrossIncludes
def validateCrossIncludes(sortedIncludes, pathElements)
Definition: Rules.py:94