CatapultServer
v0.5.0.1 (Elephant)
|
Classes | |
struct | BlockChainSyncHandlers |
Handlers used by the block chain sync consumer. More... | |
struct | HashCheckOptions |
Options for configuring the hash check consumer. More... | |
class | RecentHashCache |
A hash cache that holds recently seen hashes. More... | |
struct | TransactionsChangeInfo |
Information passed to a transactions change handler. More... | |
class | WeakBlockInfo |
A tuple composed of a block, a hash and a generation hash. More... | |
Typedefs | |
using | BlockChainProcessor = std::function< validators::ValidationResult(const WeakBlockInfo &, disruptor::BlockElements &, observers::ObserverState &)> |
using | BlockHitPredicate = predicate< const model::Block &, const model::Block &, const GenerationHash & > |
A predicate for determining whether or not two blocks form a hit. More... | |
using | BlockHitPredicateFactory = std::function< BlockHitPredicate(const cache::ReadOnlyCatapultCache &)> |
A factory for creating a predicate for determining whether or not two blocks form a hit. More... | |
using | RequiresValidationPredicate = model::MatchingEntityPredicate |
Predicate for checking whether or not an entity requires validation. More... | |
using | NewBlockSink = consumer< const std::shared_ptr< const model::Block > & > |
Prototype for a function that is called with a new block. More... | |
using | TransactionInfos = std::vector< model::TransactionInfo > |
Container for transactions infos. More... | |
using | NewTransactionsSink = consumer< TransactionInfos && > |
Prototype for a function that is called with new transactions. More... | |
Enumerations | |
enum | ReceiptValidationMode { ReceiptValidationMode::Disabled, ReceiptValidationMode::Enabled } |
Possible receipt validation modes. More... | |
enum | UndoBlockType { UndoBlockType::Rollback, UndoBlockType::Common } |
Type of block passed to undo block handler. More... | |
enum | CommitOperationStep : uint16_t { CommitOperationStep::Blocks_Written, CommitOperationStep::State_Written, CommitOperationStep::All_Updated } |
Steps in a commit operation. More... | |
Functions | |
disruptor::ConstDisruptorConsumer | CreateAuditConsumer (const std::string &auditDirectory) |
Creates an audit consumer that saves all consumer inputs to auditDirectory. More... | |
disruptor::ConstBlockConsumer | CreateBlockChainCheckConsumer (uint32_t maxChainSize, const utils::TimeSpan &maxBlockFutureTime, const chain::TimeSupplier &timeSupplier) |
BlockChainProcessor | CreateBlockChainProcessor (const BlockHitPredicateFactory &blockHitPredicateFactory, const chain::BatchEntityProcessor &batchEntityProcessor, ReceiptValidationMode receiptValidationMode) |
disruptor::ConstDisruptorConsumer | CreateBlockChainSyncCleanupConsumer (const std::string &dataDirectory) |
Creates a consumer that cleans up temporary state produced by the block chain sync consumer given dataDirectory. More... | |
disruptor::DisruptorConsumer | CreateBlockChainSyncConsumer (cache::CatapultCache &cache, state::CatapultState &state, io::BlockStorageCache &storage, uint32_t maxRollbackBlocks, const BlockChainSyncHandlers &handlers) |
disruptor::BlockConsumer | CreateBlockHashCalculatorConsumer (const GenerationHash &generationHash, const model::TransactionRegistry &transactionRegistry) |
disruptor::ConstBlockConsumer | CreateBlockHashCheckConsumer (const chain::TimeSupplier &timeSupplier, const HashCheckOptions &options) |
disruptor::ConstBlockConsumer | CreateBlockStatelessValidationConsumer (const std::shared_ptr< const validators::stateless::AggregateEntityValidator > &pValidator, const std::shared_ptr< const validators::ParallelValidationPolicy > &pValidationPolicy, const RequiresValidationPredicate &requiresValidationPredicate) |
disruptor::DisruptorConsumer | CreateNewBlockConsumer (const NewBlockSink &newBlockSink, disruptor::InputSource sinkSourceMask) |
constexpr disruptor::ConsumerResult | Continue () |
Creates a continuation consumer result. More... | |
constexpr disruptor::ConsumerResult | Abort (validators::ValidationResult validationResult) |
Creates an aborted consumer result around validationResult. More... | |
constexpr disruptor::ConsumerResult | CompleteSuccess () |
Creates a completed success consumer result. More... | |
constexpr disruptor::ConsumerResult | CompleteNeutral () |
Creates a completed neutral consumer result. More... | |
DEFINE_CONSUMER_RESULT (Empty_Input, 1) | |
Validation failed because the consumer input is empty. More... | |
DEFINE_CONSUMER_RESULT (Block_Transactions_Hash_Mismatch, 2) | |
Validation failed because the block transactions hash does not match the calculated value. More... | |
DEFINE_NEUTRAL_CONSUMER_RESULT (Hash_In_Recency_Cache, 3) | |
Validation failed because an entity hash is present in the recency cache. More... | |
DEFINE_CONSUMER_RESULT (Remote_Chain_Too_Many_Blocks, 4) | |
Validation failed because the chain part has too many blocks. More... | |
DEFINE_CONSUMER_RESULT (Remote_Chain_Improper_Link, 5) | |
Validation failed because the chain is internally improperly linked. More... | |
DEFINE_CONSUMER_RESULT (Remote_Chain_Duplicate_Transactions, 6) | |
Validation failed because the chain part contains duplicate transactions. More... | |
DEFINE_CONSUMER_RESULT (Remote_Chain_Unlinked, 7) | |
Validation failed because the chain part does not link to the current chain. More... | |
DEFINE_CONSUMER_RESULT (Remote_Chain_Mismatched_Difficulties, 8) | |
Validation failed because the remote chain difficulties do not match the calculated difficulties. More... | |
DEFINE_CONSUMER_RESULT (Remote_Chain_Score_Not_Better, 9) | |
Validation failed because the remote chain score is not better. More... | |
DEFINE_CONSUMER_RESULT (Remote_Chain_Too_Far_Behind, 10) | |
Validation failed because the remote chain is too far behind. More... | |
DEFINE_CONSUMER_RESULT (Remote_Chain_Too_Far_In_Future, 11) | |
Validation failed because the remote chain timestamp is too far in the future. More... | |
ionet::NodeInteractionResult | ToNodeInteractionResult (const Key &sourcePublicKey, const disruptor::ConsumerCompletionResult &result) |
Converts a consumer completion result to a node interaction result with public key sourcePublicKey. More... | |
disruptor::TransactionConsumer | CreateTransactionHashCalculatorConsumer (const GenerationHash &generationHash, const model::TransactionRegistry &transactionRegistry) |
disruptor::TransactionConsumer | CreateTransactionHashCheckConsumer (const chain::TimeSupplier &timeSupplier, const HashCheckOptions &options, const chain::KnownHashPredicate &knownHashPredicate) |
std::vector< const model::Block * > | ExtractBlocks (const BlockElements &elements) |
Extracts all blocks from elements. More... | |
utils::HashPointerSet | ExtractTransactionHashes (const BlockElements &elements) |
Extracts all transaction hashes from elements. More... | |
void | ExtractEntityInfos (const TransactionElements &elements, model::WeakEntityInfos &entityInfos, std::vector< size_t > &entityInfoElementIndexes) |
TransactionInfos | CollectRevertedTransactionInfos (const utils::HashPointerSet &addedTransactionHashes, TransactionInfos &&removedTransactionInfos) |
disruptor::DisruptorConsumer | CreateNewBlockConsumer (const NewBlockSink &newBlockSink, InputSource sinkSourceMask) |
disruptor::DisruptorConsumer | CreateNewTransactionsConsumer (const NewTransactionsSink &newTransactionsSink) |
disruptor::DisruptorInspector | CreateReclaimMemoryInspector () |
Creates an inspector that reclaims memory. More... | |
disruptor::TransactionConsumer | CreateTransactionStatelessValidationConsumer (const std::shared_ptr< const validators::stateless::AggregateEntityValidator > &pValidator, const std::shared_ptr< const validators::ParallelValidationPolicy > &pValidationPolicy, const chain::FailedTransactionSink &failedTransactionSink) |
void | UndoBlock (const model::BlockElement &blockElement, const chain::BlockExecutionContext &executionContext, UndoBlockType undoBlockType) |
Undoes blockElement using the specified execution context (executionContext) for undo of specified type (undoBlockType). More... | |
using catapult::consumers::BlockChainProcessor = typedef std::function<validators::ValidationResult ( const WeakBlockInfo&, disruptor::BlockElements&, observers::ObserverState&)> |
Function signature for validating, executing and updating a partial block chain given a parent block info and updating a cache.
using catapult::consumers::BlockHitPredicate = typedef predicate<const model::Block&, const model::Block&, const GenerationHash&> |
A predicate for determining whether or not two blocks form a hit.
using catapult::consumers::BlockHitPredicateFactory = typedef std::function<BlockHitPredicate (const cache::ReadOnlyCatapultCache&)> |
A factory for creating a predicate for determining whether or not two blocks form a hit.
using catapult::consumers::NewBlockSink = typedef consumer<const std::shared_ptr<const model::Block>&> |
Prototype for a function that is called with a new block.
using catapult::consumers::NewTransactionsSink = typedef consumer<TransactionInfos&&> |
Prototype for a function that is called with new transactions.
Predicate for checking whether or not an entity requires validation.
using catapult::consumers::TransactionInfos = typedef std::vector<model::TransactionInfo> |
Container for transactions infos.
|
strong |
|
strong |
|
strong |
|
constexpr |
Creates an aborted consumer result around validationResult.
TransactionInfos catapult::consumers::CollectRevertedTransactionInfos | ( | const utils::HashPointerSet & | addedTransactionHashes, |
TransactionInfos && | removedTransactionInfos | ||
) |
Filters removedTransactionInfos by removing all transaction infos that have a corresponding hash in addedTransactionHashes.
|
constexpr |
Creates a completed neutral consumer result.
|
constexpr |
Creates a completed success consumer result.
|
constexpr |
Creates a continuation consumer result.
disruptor::ConstDisruptorConsumer catapult::consumers::CreateAuditConsumer | ( | const std::string & | auditDirectory | ) |
Creates an audit consumer that saves all consumer inputs to auditDirectory.
disruptor::ConstBlockConsumer catapult::consumers::CreateBlockChainCheckConsumer | ( | uint32_t | maxChainSize, |
const utils::TimeSpan & | maxBlockFutureTime, | ||
const chain::TimeSupplier & | timeSupplier | ||
) |
Creates a consumer that checks a block chain for internal integrity. A valid chain must have no more than maxChainSize blocks and end no more than maxBlockFutureTime past the current time supplied by timeSupplier.
BlockChainProcessor catapult::consumers::CreateBlockChainProcessor | ( | const BlockHitPredicateFactory & | blockHitPredicateFactory, |
const chain::BatchEntityProcessor & | batchEntityProcessor, | ||
ReceiptValidationMode | receiptValidationMode | ||
) |
Creates a block chain processor around the specified block hit predicate factory (blockHitPredicateFactory) and batch entity processor (batchEntityProcessor) with receiptValidationMode.
disruptor::ConstDisruptorConsumer catapult::consumers::CreateBlockChainSyncCleanupConsumer | ( | const std::string & | dataDirectory | ) |
Creates a consumer that cleans up temporary state produced by the block chain sync consumer given dataDirectory.
disruptor::DisruptorConsumer catapult::consumers::CreateBlockChainSyncConsumer | ( | cache::CatapultCache & | cache, |
state::CatapultState & | state, | ||
io::BlockStorageCache & | storage, | ||
uint32_t | maxRollbackBlocks, | ||
const BlockChainSyncHandlers & | handlers | ||
) |
Creates a consumer that attempts to synchronize a remote chain with the local chain, which is composed of state (in cache and state) and blocks (in storage). maxRollbackBlocks The maximum number of blocks that can be rolled back. handlers are used to customize the sync process.
disruptor::BlockConsumer catapult::consumers::CreateBlockHashCalculatorConsumer | ( | const GenerationHash & | generationHash, |
const model::TransactionRegistry & | transactionRegistry | ||
) |
Creates a consumer that calculates hashes of all entities using transactionRegistry for the network with the specified generation hash (generationHash).
disruptor::ConstBlockConsumer catapult::consumers::CreateBlockHashCheckConsumer | ( | const chain::TimeSupplier & | timeSupplier, |
const HashCheckOptions & | options | ||
) |
Creates a consumer that checks entities for previous processing based on their hash. timeSupplier is used for generating timestamps and options specifies additional cache options.
disruptor::ConstBlockConsumer catapult::consumers::CreateBlockStatelessValidationConsumer | ( | const std::shared_ptr< const validators::stateless::AggregateEntityValidator > & | pValidator, |
const std::shared_ptr< const validators::ParallelValidationPolicy > & | pValidationPolicy, | ||
const RequiresValidationPredicate & | requiresValidationPredicate | ||
) |
Creates a consumer that runs stateless validation using pValidator and the specified policy (pValidationPolicy). Validation will only be performed for entities for which requiresValidationPredicate returns true
.
disruptor::DisruptorConsumer catapult::consumers::CreateNewBlockConsumer | ( | const NewBlockSink & | newBlockSink, |
disruptor::InputSource | sinkSourceMask | ||
) |
Creates a consumer that calls newBlockSink with new blocks that have a source in sinkSourceMask.
disruptor::DisruptorConsumer catapult::consumers::CreateNewBlockConsumer | ( | const NewBlockSink & | newBlockSink, |
InputSource | sinkSourceMask | ||
) |
disruptor::DisruptorConsumer catapult::consumers::CreateNewTransactionsConsumer | ( | const NewTransactionsSink & | newTransactionsSink | ) |
Creates a consumer that calls newTransactionsSink with all new transactions.
disruptor::DisruptorInspector catapult::consumers::CreateReclaimMemoryInspector | ( | ) |
Creates an inspector that reclaims memory.
disruptor::TransactionConsumer catapult::consumers::CreateTransactionHashCalculatorConsumer | ( | const GenerationHash & | generationHash, |
const model::TransactionRegistry & | transactionRegistry | ||
) |
Creates a consumer that calculates hashes of all entities using transactionRegistry for the network with the specified generation hash (generationHash).
disruptor::TransactionConsumer catapult::consumers::CreateTransactionHashCheckConsumer | ( | const chain::TimeSupplier & | timeSupplier, |
const HashCheckOptions & | options, | ||
const chain::KnownHashPredicate & | knownHashPredicate | ||
) |
Creates a consumer that checks entities for previous processing based on their hash. timeSupplier is used for generating timestamps and options specifies additional cache options. knownHashPredicate returns true
for known hashes.
disruptor::TransactionConsumer catapult::consumers::CreateTransactionStatelessValidationConsumer | ( | const std::shared_ptr< const validators::stateless::AggregateEntityValidator > & | pValidator, |
const std::shared_ptr< const validators::ParallelValidationPolicy > & | pValidationPolicy, | ||
const chain::FailedTransactionSink & | failedTransactionSink | ||
) |
Creates a consumer that runs stateless validation using pValidator and the specified policy (pValidationPolicy) and calls failedTransactionSink for each failure.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Block_Transactions_Hash_Mismatch | , |
2 | |||
) |
Validation failed because the block transactions hash does not match the calculated value.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Empty_Input | , |
1 | |||
) |
Validation failed because the consumer input is empty.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Remote_Chain_Duplicate_Transactions | , |
6 | |||
) |
Validation failed because the chain part contains duplicate transactions.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Remote_Chain_Improper_Link | , |
5 | |||
) |
Validation failed because the chain is internally improperly linked.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Remote_Chain_Mismatched_Difficulties | , |
8 | |||
) |
Validation failed because the remote chain difficulties do not match the calculated difficulties.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Remote_Chain_Score_Not_Better | , |
9 | |||
) |
Validation failed because the remote chain score is not better.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Remote_Chain_Too_Far_Behind | , |
10 | |||
) |
Validation failed because the remote chain is too far behind.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Remote_Chain_Too_Far_In_Future | , |
11 | |||
) |
Validation failed because the remote chain timestamp is too far in the future.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Remote_Chain_Too_Many_Blocks | , |
4 | |||
) |
Validation failed because the chain part has too many blocks.
catapult::consumers::DEFINE_CONSUMER_RESULT | ( | Remote_Chain_Unlinked | , |
7 | |||
) |
Validation failed because the chain part does not link to the current chain.
catapult::consumers::DEFINE_NEUTRAL_CONSUMER_RESULT | ( | Hash_In_Recency_Cache | , |
3 | |||
) |
Validation failed because an entity hash is present in the recency cache.
std::vector< const model::Block * > catapult::consumers::ExtractBlocks | ( | const BlockElements & | elements | ) |
Extracts all blocks from elements.
void catapult::consumers::ExtractEntityInfos | ( | const TransactionElements & | elements, |
model::WeakEntityInfos & | entityInfos, | ||
std::vector< size_t > & | entityInfoElementIndexes | ||
) |
Extracts all non-skipped entity infos from elements into entityInfos and stores corresponding element indexes in entityInfoElementIndexes.
utils::HashPointerSet catapult::consumers::ExtractTransactionHashes | ( | const BlockElements & | elements | ) |
Extracts all transaction hashes from elements.
ionet::NodeInteractionResult catapult::consumers::ToNodeInteractionResult | ( | const Key & | sourcePublicKey, |
const disruptor::ConsumerCompletionResult & | result | ||
) |
Converts a consumer completion result to a node interaction result with public key sourcePublicKey.
void catapult::consumers::UndoBlock | ( | const model::BlockElement & | blockElement, |
const chain::BlockExecutionContext & | executionContext, | ||
UndoBlockType | undoBlockType | ||
) |
Undoes blockElement using the specified execution context (executionContext) for undo of specified type (undoBlockType).