CatapultServer  v0.5.0.1 (Elephant)
HarvestingUtFacadeFactory.h
Go to the documentation of this file.
1 
21 #pragma once
24 #include "catapult/model/Block.h"
26 
27 namespace catapult { namespace harvesting {
28 
31  public:
34  Timestamp blockTime,
35  const cache::CatapultCache& cache,
36  const model::BlockChainConfiguration& blockChainConfig,
37  const chain::ExecutionConfiguration& executionConfig);
38 
41 
42  public:
44  Height height() const;
45 
47  size_t size() const;
48 
50  const std::vector<model::TransactionInfo>& transactionInfos() const;
51 
52  public:
54  bool apply(const model::TransactionInfo& transactionInfo);
55 
57  void unapply();
58 
60  std::unique_ptr<model::Block> commit(const model::BlockHeader& blockHeader);
61 
62  private:
63  class Impl;
64 
65  private:
66  std::vector<model::TransactionInfo> m_transactionInfos;
67  std::unique_ptr<Impl> m_pImpl;
68  };
69 
72  public:
75  const cache::CatapultCache& cache,
76  const model::BlockChainConfiguration& blockChainConfig,
77  const chain::ExecutionConfiguration& executionConfig);
78 
79  public:
81  std::unique_ptr<HarvestingUtFacade> create(Timestamp blockTime) const;
82 
83  private:
87  };
88 }}
Block.h
catapult::harvesting::HarvestingUtFacade::Impl::unapply
void unapply(const model::TransactionInfo &transactionInfo)
Definition: HarvestingUtFacadeFactory.cpp:57
ExecutionConfiguration.h
catapult::harvesting::HarvestingUtFacade::Impl::Processor
predicate< const validators::stateful::NotificationValidator &, const validators::ValidatorContext &, const observers::NotificationObserver &, observers::ObserverContext & > Processor
Definition: HarvestingUtFacadeFactory.cpp:95
catapult::model::BlockChainConfiguration::ShouldEnableVerifiableReceipts
bool ShouldEnableVerifiableReceipts
true if block chain should calculate receipts so that state changes are fully verifiable at each bloc...
Definition: BlockChainConfiguration.h:42
catapult::harvesting::HarvestingUtFacade::transactionInfos
const std::vector< model::TransactionInfo > & transactionInfos() const
Gets all successfully applied transactions.
Definition: HarvestingUtFacadeFactory.cpp:183
catapult::harvesting::HarvestingUtFacade::Impl::m_blockTime
Timestamp m_blockTime
Definition: HarvestingUtFacadeFactory.cpp:152
catapult::Hash256
utils::ByteArray< Hash256_Size, Hash256_tag > Hash256
Definition: src/catapult/types.h:47
catapult::harvesting::HarvestingUtFacade::commit
std::unique_ptr< model::Block > commit(const model::BlockHeader &blockHeader)
Commits all transactions into a block with specified seed header (blockHeader).
Definition: HarvestingUtFacadeFactory.cpp:203
catapult::harvesting::HarvestingUtFacade::Impl::m_cacheDetachedDelta
cache::CatapultCacheDetachedDelta m_cacheDetachedDelta
Definition: HarvestingUtFacadeFactory.cpp:156
catapult::model::BlockChainConfiguration
Block chain configuration settings.
Definition: BlockChainConfiguration.h:33
catapult::validators::IsValidationResultSuccess
constexpr bool IsValidationResultSuccess(ValidationResult result)
Returns a value indicating whether the validation result is a success.
Definition: ValidationResult.h:90
BlockChainConfiguration.h
catapult::observers::ObserverContext
Context passed to all the observers.
Definition: ObserverContext.h:78
catapult::Amount
utils::BaseValue< uint64_t, Amount_tag > Amount
Definition: src/catapult/types.h:76
catapult::harvesting::HarvestingUtFacade::Impl::m_pCacheDelta
std::unique_ptr< cache::CatapultCacheDelta > m_pCacheDelta
Definition: HarvestingUtFacadeFactory.cpp:157
catapult::predicate
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
catapult::validators::NotificationValidatorT
A strongly typed notification validator.
Definition: NotificationValidator.h:30
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::chain::ExecutionConfiguration::Network
model::NetworkInfo Network
Network info.
Definition: ExecutionConfiguration.h:39
catapult::model::BlockChainConfiguration::ShouldEnableVerifiableState
bool ShouldEnableVerifiableState
true if block chain should calculate state hashes so that state is fully verifiable at each block.
Definition: BlockChainConfiguration.h:39
catapult::chain::ProcessingNotificationSubscriber::enableUndo
void enableUndo()
Enables subsequent notifications to be undone.
Definition: ProcessingNotificationSubscriber.cpp:44
catapult::chain::ProcessingNotificationSubscriber
A notification subscriber that processes notifications.
Definition: ProcessingNotificationSubscriber.h:29
catapult::model::BlockHeader
Binary layout for a block header.
Definition: Block.h:34
catapult::harvesting::HarvestingUtFacade::Impl::m_executionConfig
chain::ExecutionConfiguration m_executionConfig
Definition: HarvestingUtFacadeFactory.cpp:154
catapult::model::Transactions
std::vector< std::shared_ptr< const Transaction > > Transactions
Container of transactions.
Definition: BlockUtils.h:71
catapult::model::StitchBlock
std::unique_ptr< Block > StitchBlock(const BlockHeader &blockHeader, const Transactions &transactions)
Creates a new block by stitching together blockHeader and transactions.
Definition: BlockUtils.cpp:146
catapult::harvesting::HarvestingUtFacade::Impl::m_blockStatementBuilder
model::BlockStatementBuilder m_blockStatementBuilder
Definition: HarvestingUtFacadeFactory.cpp:158
catapult::model::TransactionInfo
A transaction and its associated metadata.
Definition: EntityInfo.h:104
catapult::chain::ExecutionConfiguration::pObserver
ObserverPointer pObserver
Observer.
Definition: ExecutionConfiguration.h:42
catapult::harvesting::HarvestingUtFacade::Impl
Definition: HarvestingUtFacadeFactory.cpp:32
catapult::harvesting::HarvestingUtFacade::Impl::commit
std::unique_ptr< model::Block > commit(const model::BlockHeader &blockHeader, const model::Transactions &transactions)
Definition: HarvestingUtFacadeFactory.cpp:62
catapult::harvesting::HarvestingUtFacadeFactory::m_cache
const cache::CatapultCache & m_cache
Definition: HarvestingUtFacadeFactory.h:84
catapult::harvesting::HarvestingUtFacade::Impl::height
Height height() const
Definition: HarvestingUtFacadeFactory.cpp:48
catapult::utils::BaseValue< uint64_t, Timestamp_tag >
catapult::harvesting::HarvestingUtFacade::size
size_t size() const
Gets the number of successfully applied transactions.
Definition: HarvestingUtFacadeFactory.cpp:179
catapult::validators::ValidatorContext
Contextual information passed to stateful validators.
Definition: ValidatorContext.h:32
catapult::harvesting::HarvestingUtFacade::Impl::apply
bool apply(const model::TransactionInfo &transactionInfo)
Definition: HarvestingUtFacadeFactory.cpp:53
catapult::harvesting::HarvestingUtFacadeFactory::m_blockChainConfig
model::BlockChainConfiguration m_blockChainConfig
Definition: HarvestingUtFacadeFactory.h:85
CATAPULT_THROW_OUT_OF_RANGE
#define CATAPULT_THROW_OUT_OF_RANGE(MESSAGE)
Macro used to throw a catapult out of range.
Definition: exceptions.h:191
catapult::model::CalculateMerkleHash
Hash256 CalculateMerkleHash(const BlockStatement &statement)
Calculates the merkle hash for statement.
Definition: BlockStatement.cpp:83
catapult::model::WeakEntityInfoT
Wrapper around a strongly typed entity and its associated metadata.
Definition: WeakEntityInfo.h:33
catapult::harvesting::HarvestingUtFacade::Impl::Impl
Impl(Timestamp blockTime, const cache::CatapultCache &cache, const model::BlockChainConfiguration &blockChainConfig, const chain::ExecutionConfiguration &executionConfig)
Definition: HarvestingUtFacadeFactory.cpp:34
catapult::chain::ExecutionConfiguration
Configuration for executing entities.
Definition: ExecutionConfiguration.h:30
catapult::cache::CatapultCacheDetachableDelta::height
Height height() const
Gets the cache height associated with this delta.
Definition: CatapultCache.cpp:175
catapult::harvesting::HarvestingUtFacadeFactory::HarvestingUtFacadeFactory
HarvestingUtFacadeFactory(const cache::CatapultCache &cache, const model::BlockChainConfiguration &blockChainConfig, const chain::ExecutionConfiguration &executionConfig)
Creates a factory around cache, blockChainConfig and executionConfig.
Definition: HarvestingUtFacadeFactory.cpp:220
catapult::chain::ProcessingUndoNotificationSubscriber
A notification subscriber that captures notifications and allows them to be undone.
Definition: ProcessingUndoNotificationSubscriber.h:28
catapult::harvesting::HarvestingUtFacade::m_transactionInfos
std::vector< model::TransactionInfo > m_transactionInfos
Definition: HarvestingUtFacadeFactory.h:63
catapult::model::BlockChainConfiguration::ImportanceGrouping
uint64_t ImportanceGrouping
Definition: BlockChainConfiguration.h:61
catapult::model::BlockChainConfiguration::CurrencyMosaicId
MosaicId CurrencyMosaicId
Mosaic id used as primary chain currency.
Definition: BlockChainConfiguration.h:45
catapult::harvesting::HarvestingUtFacade::m_pImpl
std::unique_ptr< Impl > m_pImpl
Definition: HarvestingUtFacadeFactory.h:67
catapult::observers::ObserverState
Block independent mutable state passed to all observers.
Definition: ObserverContext.h:54
catapult::model::BlockStatementBuilder::build
std::unique_ptr< BlockStatement > build()
Builds a block statement.
Definition: BlockStatementBuilder.cpp:88
catapult::model::BlockHeader::Height
catapult::Height Height
Height of a block.
Definition: Block.h:41
catapult::chain::ProcessingNotificationSubscriber::undo
void undo()
Undoes all executions since enableUndo was first called.
Definition: ProcessingNotificationSubscriber.cpp:48
catapult::harvesting::HarvestingUtFacade::unapply
void unapply()
Unapplies last successfully applied transaction.
Definition: HarvestingUtFacadeFactory.cpp:195
catapult::model::BlockStatementBuilder
Collection of receipts scoped to a block.
Definition: BlockStatementBuilder.h:27
catapult::cache::CatapultCache
Central cache holding all sub caches.
Definition: CatapultCache.h:40
catapult::state::CatapultState
Stateful catapult information.
Definition: CatapultState.h:27
catapult::harvesting::HarvestingUtFacade::Impl::m_cacheDetachableDelta
cache::CatapultCacheDetachableDelta m_cacheDetachableDelta
Definition: HarvestingUtFacadeFactory.cpp:155
catapult::harvesting::HarvestingUtFacade::~HarvestingUtFacade
~HarvestingUtFacade()
Destroys the facade.
catapult::observers::NotificationObserverT
A strongly typed notification observer.
Definition: NotificationObserver.h:29
CatapultCache.h
catapult::harvesting::HarvestingUtFacadeFactory
Factory for creating unconfirmed transactions facades.
Definition: HarvestingUtFacadeFactory.h:71
AccountStateCache.h
catapult::cache::AccountStateCache
Synchronized cache composed of stateful account information.
Definition: AccountStateCache.h:72
catapult::harvesting::HarvestingUtFacade::Impl::process
bool process(const Processor &processor)
Definition: HarvestingUtFacadeFactory.cpp:97
catapult::model::BlockHeader::FeeMultiplier
BlockFeeMultiplier FeeMultiplier
Fee multiplier applied to transactions contained in block.
Definition: Block.h:50
HarvestingUtFacadeFactory.h
catapult::harvesting::HarvestingUtFacade::Impl::unapply
void unapply(const model::WeakEntityInfo &weakEntityInfo)
Definition: HarvestingUtFacadeFactory.cpp:139
catapult::chain::ProcessingNotificationSubscriber::result
validators::ValidationResult result() const
Gets the aggregate result of processed notifications.
Definition: ProcessingNotificationSubscriber.cpp:40
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult::model::BlockStatementBuilder::popSource
void popSource()
Decrements the current primary source and removes all receipts associated with it.
Definition: BlockStatementBuilder.cpp:38
catapult::chain::ExecutionConfiguration::ResolverContextFactory
ResolverContextFactoryFunc ResolverContextFactory
Resolver context factory.
Definition: ExecutionConfiguration.h:51
FeeUtils.h
catapult::cache::CatapultCacheDetachedDelta
Detached delta of the catapult cache.
Definition: CatapultCacheDetachedDelta.h:30
catapult::chain::ExecutionConfiguration::pNotificationPublisher
PublisherPointer pNotificationPublisher
Notification publisher.
Definition: ExecutionConfiguration.h:48
catapult::model::EntityInfo::pEntity
std::shared_ptr< TEntity > pEntity
Entity pointer.
Definition: EntityInfo.h:45
catapult::harvesting::HarvestingUtFacade::Impl::apply
bool apply(const model::WeakEntityInfo &weakEntityInfo)
Definition: HarvestingUtFacadeFactory.cpp:119
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::cache::CatapultCacheDetachableDelta
Definition: CatapultCacheDetachableDelta.h:32
catapult::harvesting::HarvestingUtFacadeFactory::m_executionConfig
chain::ExecutionConfiguration m_executionConfig
Definition: HarvestingUtFacadeFactory.h:86
catapult::model::CalculateTransactionFee
Amount CalculateTransactionFee(BlockFeeMultiplier feeMultiplier, const Transaction &transaction)
Calculates the fee for transaction contained in block with feeMultiplier.
Definition: FeeUtils.cpp:26
catapult::model::EntityInfo::EntityHash
Hash256 EntityHash
Entity hash.
Definition: EntityInfo.h:48
ProcessingNotificationSubscriber.h
catapult::harvesting::HarvestingUtFacade::HarvestingUtFacade
HarvestingUtFacade(Timestamp blockTime, const cache::CatapultCache &cache, const model::BlockChainConfiguration &blockChainConfig, const chain::ExecutionConfiguration &executionConfig)
Creates a facade around blockTime, cache, blockChainConfig and executionConfig.
Definition: HarvestingUtFacadeFactory.cpp:165
catapult::chain::ExecutionConfiguration::pValidator
ValidatorPointer pValidator
Stateful validator.
Definition: ExecutionConfiguration.h:45
catapult::model::ConvertToImportanceHeight
ImportanceHeight ConvertToImportanceHeight(Height height, Height::ValueType grouping)
Definition: ImportanceHeight.cpp:33
m_cache
const cache::CatapultCache & m_cache
Definition: JointValidator.cpp:84
BlockUtils.h
catapult::harvesting::HarvestingUtFacadeFactory::create
std::unique_ptr< HarvestingUtFacade > create(Timestamp blockTime) const
Creates a facade for applying transactions at a given block time (blockTime).
Definition: HarvestingUtFacadeFactory.cpp:229
catapult::harvesting::HarvestingUtFacade::Impl::m_blockChainConfig
model::BlockChainConfiguration m_blockChainConfig
Definition: HarvestingUtFacadeFactory.cpp:153
catapult::harvesting::HarvestingUtFacade
Facade around unconfirmed transactions cache and updater.
Definition: HarvestingUtFacadeFactory.h:30
catapult::harvesting::HarvestingUtFacade::apply
bool apply(const model::TransactionInfo &transactionInfo)
Attempts to apply transactionInfo to the cache.
Definition: HarvestingUtFacadeFactory.cpp:187
catapult::model::TransactionInfo::copy
TransactionInfo copy() const
Creates a (shallow) copy of this info.
Definition: EntityInfo.h:122
catapult::chain::ProcessingUndoNotificationSubscriber::undo
void undo()
Undoes all executions.
Definition: ProcessingUndoNotificationSubscriber.cpp:32
catapult::harvesting::HarvestingUtFacade::height
Height height() const
Gets locked height.
Definition: HarvestingUtFacadeFactory.cpp:175