CatapultServer  v0.5.0.1 (Elephant)
BlockChainSyncHandlers.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "BlockChainProcessor.h"
25 
26 namespace catapult {
27  namespace cache { class CatapultCache; }
28  namespace chain { struct ObserverState; }
29 }
30 
31 namespace catapult { namespace consumers {
32 
35  public:
38  const utils::HashPointerSet& addedTransactionHashes,
39  const std::vector<model::TransactionInfo>& revertedTransactionInfos)
40  : AddedTransactionHashes(addedTransactionHashes)
41  , RevertedTransactionInfos(revertedTransactionInfos)
42  {}
43 
44  public:
47 
49  const std::vector<model::TransactionInfo>& RevertedTransactionInfos;
50  };
51 
53  enum class UndoBlockType {
55  Rollback,
56 
58  Common
59  };
60 
62  enum class CommitOperationStep : uint16_t {
65 
68 
71  };
72 
75  public:
78 
82 
85 
88 
91 
94 
95  public:
98 
101 
104 
107 
110 
113 
116  };
117 }}
m_handlers
BlockChainSyncHandlers m_handlers
Definition: BlockChainSyncConsumer.cpp:292
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
m_pCommonBlockElement
std::shared_ptr< const model::BlockElement > m_pCommonBlockElement
Definition: BlockChainSyncConsumer.cpp:114
InputUtils.h
FileQueue.h
catapult::validators::IsValidationResultSuccess
constexpr bool IsValidationResultSuccess(ValidationResult result)
Returns a value indicating whether the validation result is a success.
Definition: ValidationResult.h:90
catapult::consumers::BlockChainSyncHandlers::DifficultyChecker
DifficultyCheckerFunc DifficultyChecker
Checks all difficulties in a block chain for correctness.
Definition: BlockChainSyncHandlers.h:97
catapult::consumers::TransactionsChangeInfo::TransactionsChangeInfo
TransactionsChangeInfo(const utils::HashPointerSet &addedTransactionHashes, const std::vector< model::TransactionInfo > &revertedTransactionInfos)
Creates a new transactions change info around addedTransactionHashes and revertedTransactionInfos.
Definition: BlockChainSyncHandlers.h:37
catapult::consumers::TransactionsChangeInfo::RevertedTransactionInfos
const std::vector< model::TransactionInfo > & RevertedTransactionInfos
Infos of the transactions that were reverted (previously confirmed).
Definition: BlockChainSyncHandlers.h:49
catapult::consumers::CommitOperationStep::State_Written
State was written to disk.
catapult::predicate
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
catapult::config::CatapultDataDirectory
Catapult data directory.
Definition: CatapultDataDirectory.h:61
colorPrint.warning
def warning(*args)
Definition: colorPrint.py:10
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::disruptor::InputSource
InputSource
Possible consumer input sources.
Definition: InputSource.h:42
ChainUtils.h
catapult::consumers::BlockChainSyncHandlers::CommitStepFunc
consumer< CommitOperationStep > CommitStepFunc
Prototype for commit step notification.
Definition: BlockChainSyncHandlers.h:93
BlockConsumers.h
catapult::consumers::BlockChainSyncHandlers::Processor
BlockChainProcessor Processor
Processes (validates and executes) a block chain.
Definition: BlockChainSyncHandlers.h:100
catapult::consumers::UndoBlockType
UndoBlockType
Type of block passed to undo block handler.
Definition: BlockChainSyncHandlers.h:53
catapult::consumers::CreateBlockChainSyncConsumer
disruptor::DisruptorConsumer CreateBlockChainSyncConsumer(cache::CatapultCache &cache, state::CatapultState &state, io::BlockStorageCache &storage, uint32_t maxRollbackBlocks, const BlockChainSyncHandlers &handlers)
Definition: BlockChainSyncConsumer.cpp:296
BlockChainProcessor.h
m_storage
io::BlockStorageCache & m_storage
Definition: BlockChainSyncConsumer.cpp:290
catapult::disruptor::CompletionStatus::Aborted
Processing of the entity was aborted by a consumer.
CatapultDataDirectory.h
catapult::disruptor::ConstDisruptorConsumer
DisruptorConsumerT< const ConsumerInput > ConstDisruptorConsumer
A const disruptor consumer function.
Definition: DisruptorConsumer.h:35
StateChangeInfo.h
ConsumerResultFactory.h
catapult::consumers::CommitOperationStep::All_Updated
Everything was updated.
catapult::model::ExtractTransactionInfos
void ExtractTransactionInfos(std::vector< TransactionInfo > &transactionInfos, const std::shared_ptr< const BlockElement > &pBlockElement)
Definition: Elements.cpp:93
m_pOriginalCache
cache::CatapultCache * m_pOriginalCache
Definition: BlockChainSyncConsumer.cpp:110
Score
model::ChainScore Score
Definition: BlockChainSyncConsumer.cpp:43
catapult::consumers::ExtractTransactionHashes
utils::HashPointerSet ExtractTransactionHashes(const BlockElements &elements)
Extracts all transaction hashes from elements.
Definition: InputUtils.cpp:35
catapult::consumers::BlockChainSyncHandlers::PreStateWrittenFunc
consumer< const cache::CatapultCacheDelta &, const state::CatapultState &, Height > PreStateWrittenFunc
Prototype for pre state written notification.
Definition: BlockChainSyncHandlers.h:87
m_stateCopy
state::CatapultState m_stateCopy
Definition: BlockChainSyncConsumer.cpp:113
catapult::chain::CalculateScore
uint64_t CalculateScore(const model::Block &parentBlock, const model::Block &currentBlock)
Calculates the score of currentBlock with parent parentBlock.
Definition: BlockScorer.cpp:99
catapult::consumers::BlockChainSyncHandlers::UndoBlockFunc
consumer< const model::BlockElement &, observers::ObserverState &, UndoBlockType > UndoBlockFunc
Definition: BlockChainSyncHandlers.h:81
catapult::io::FileQueueReader
File based queue reader where each message is represented by a file (with incrementing names) in a di...
Definition: FileQueue.h:51
catapult::config::CatapultDirectory::str
std::string str() const
Gets the directory path (as string).
Definition: CatapultDataDirectory.h:38
m_removedTransactionInfos
TransactionInfos m_removedTransactionInfos
Definition: BlockChainSyncConsumer.cpp:116
catapult::io::FileQueueReader::skip
void skip(uint32_t count)
Skips at most the next count messages.
Definition: FileQueue.cpp:121
catapult::io::BlockStorageCache
Definition: BlockStorageCache.h:97
catapult::consumers::BlockChainSyncHandlers
Handlers used by the block chain sync consumer.
Definition: BlockChainSyncHandlers.h:74
catapult::consumers::BlockChainSyncHandlers::StateChange
StateChangeFunc StateChange
Called with state change info to indicate a state change.
Definition: BlockChainSyncHandlers.h:106
catapult::consumers::TransactionsChangeInfo
Information passed to a transactions change handler.
Definition: BlockChainSyncHandlers.h:34
catapult::cache::CatapultCache
Central cache holding all sub caches.
Definition: CatapultCache.h:40
catapult::consumers::TransactionInfos
std::vector< model::TransactionInfo > TransactionInfos
Container for transactions infos.
Definition: InputUtils.h:48
BlockScorer.h
m_pOriginalState
state::CatapultState * m_pOriginalState
Definition: BlockChainSyncConsumer.cpp:111
catapult::state::CatapultState
Stateful catapult information.
Definition: CatapultState.h:27
catapult::consumers::CommitOperationStep::Blocks_Written
Blocks were written to disk.
StackLogger.h
catapult::consumers::Abort
constexpr disruptor::ConsumerResult Abort(validators::ValidationResult validationResult)
Creates an aborted consumer result around validationResult.
Definition: ConsumerResultFactory.h:34
CatapultCache.h
catapult::consumers::BlockChainSyncHandlers::UndoBlock
UndoBlockFunc UndoBlock
Undoes a block and updates a cache.
Definition: BlockChainSyncHandlers.h:103
m_state
state::CatapultState & m_state
Definition: BlockChainSyncConsumer.cpp:289
catapult::consumers::UndoBlockType::Rollback
Rolled back block.
catapult::disruptor::BlockElements
std::vector< model::BlockElement > BlockElements
A container of BlockElement.
Definition: DisruptorTypes.h:132
m_maxRollbackBlocks
uint32_t m_maxRollbackBlocks
Definition: BlockChainSyncConsumer.cpp:291
m_scoreDelta
model::ChainScore m_scoreDelta
Definition: BlockChainSyncConsumer.cpp:115
catapult::consumers::BlockChainSyncHandlers::CommitStep
CommitStepFunc CommitStep
Called with the commit operation step.
Definition: BlockChainSyncHandlers.h:115
catapult::config::CatapultDataDirectory::spoolDir
CatapultDirectory spoolDir(const std::string &name) const
Gets the spooling directory with name.
Definition: CatapultDataDirectory.h:79
ArraySet.h
catapult::consumers::CreateBlockChainSyncCleanupConsumer
disruptor::ConstDisruptorConsumer CreateBlockChainSyncCleanupConsumer(const std::string &dataDirectory)
Creates a consumer that cleans up temporary state produced by the block chain sync consumer given dat...
Definition: BlockChainSyncCleanupConsumer.cpp:29
catapult::consumers::TransactionsChangeInfo::AddedTransactionHashes
const utils::HashPointerSet & AddedTransactionHashes
Hashes of the transactions that were added (newly confirmed).
Definition: BlockChainSyncHandlers.h:46
catapult::consumers::BlockChainProcessor
std::function< validators::ValidationResult(const WeakBlockInfo &, disruptor::BlockElements &, observers::ObserverState &)> BlockChainProcessor
Definition: BlockChainProcessor.h:62
Casting.h
m_cache
cache::CatapultCache & m_cache
Definition: BlockChainSyncConsumer.cpp:288
ChainScore
model::ChainScore ChainScore
Definition: tools/health/main.cpp:43
catapult::consumers::CommitOperationStep
CommitOperationStep
Steps in a commit operation.
Definition: BlockChainSyncHandlers.h:62
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::chain::CalculatePartialChainScore
model::ChainScore CalculatePartialChainScore(const model::Block &parent, const std::vector< const model::Block * > &blocks)
Calculates the partial chain score of blocks starting at parent.
Definition: ChainUtils.cpp:90
catapult::consumers::ExtractBlocks
std::vector< const model::Block * > ExtractBlocks(const BlockElements &elements)
Extracts all blocks from elements.
Definition: InputUtils.cpp:25
catapult::consumers::BlockChainSyncHandlers::PreStateWritten
PreStateWrittenFunc PreStateWritten
Called after state change but before state written checkpoint.
Definition: BlockChainSyncHandlers.h:109
catapult::consumers::UndoBlockType::Common
New common block.
catapult::consumers::BlockChainSyncHandlers::TransactionsChangeFunc
consumer< const TransactionsChangeInfo & > TransactionsChangeFunc
Prototype for transaction change notification.
Definition: BlockChainSyncHandlers.h:90
m_pCacheDelta
std::unique_ptr< cache::CatapultCacheDelta > m_pCacheDelta
Definition: BlockChainSyncConsumer.cpp:112
catapult::utils::HashPointerSet
ArrayPointerSet< Hash256 > HashPointerSet
A hash pointer set.
Definition: ArraySet.h:70
catapult::consumers::BlockChainSyncHandlers::StateChangeFunc
consumer< const subscribers::StateChangeInfo & > StateChangeFunc
Prototype for state change notification.
Definition: BlockChainSyncHandlers.h:84
BlockStorageCache.h
catapult::disruptor::DisruptorConsumer
DisruptorConsumerT< ConsumerInput > DisruptorConsumer
A disruptor consumer function.
Definition: DisruptorConsumer.h:32
catapult::consumers::CollectRevertedTransactionInfos
TransactionInfos CollectRevertedTransactionInfos(const utils::HashPointerSet &addedTransactionHashes, TransactionInfos &&removedTransactionInfos)
Definition: InputUtils.cpp:60
catapult::consumer
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
catapult::consumers::BlockChainSyncHandlers::DifficultyCheckerFunc
predicate< const std::vector< const model::Block * > &, const cache::CatapultCache & > DifficultyCheckerFunc
Prototype for checking block difficulties.
Definition: BlockChainSyncHandlers.h:77
catapult::consumers::BlockChainSyncHandlers::TransactionsChange
TransactionsChangeFunc TransactionsChange
Called with the hashes of confirmed transactions and the infos of reverted transactions when transact...
Definition: BlockChainSyncHandlers.h:112
BlockUtils.h
catapult::utils::LogLevel::Warning
Level for logging warning events.
catapult::consumers::Continue
constexpr disruptor::ConsumerResult Continue()
Creates a continuation consumer result.
Definition: ConsumerResultFactory.h:29