CatapultServer  v0.5.0.1 (Elephant)
ChainSynchronizer.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "RemoteNodeSynchronizer.h"
26 
27 namespace catapult {
28  namespace api {
29  class ChainApi;
30  class RemoteChainApi;
31  }
32  namespace model { struct BlockChainConfiguration; }
33 }
34 
35 namespace catapult { namespace chain {
36 
39 
44 
49 
52 
55  };
56 
60  const std::shared_ptr<const api::ChainApi>& pLocalChainApi,
61  const ChainSynchronizerConfiguration& config,
62  const CompletionAwareBlockRangeConsumerFunc& blockRangeConsumer);
63 }}
catapult::chain::RemoteNodeSynchronizer
std::function< thread::future< ionet::NodeInteractionResultCode >(const TRemoteApi &)> RemoteNodeSynchronizer
Function signature for synchronizing with a remote node.
Definition: RemoteNodeSynchronizer.h:30
FutureUtils.h
m_pUnprocessedElements
std::shared_ptr< UnprocessedElements > m_pUnprocessedElements
Definition: ChainSynchronizer.cpp:305
catapult::chain::ChainSynchronizerConfiguration::MaxRollbackBlocks
uint32_t MaxRollbackBlocks
Maximum number of blocks that can be rolled back.
Definition: ChainSynchronizer.h:54
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
SpinLock.h
m_pLocalChainApi
std::shared_ptr< const api::ChainApi > m_pLocalChainApi
Definition: ChainSynchronizer.cpp:302
m_compareChainOptions
CompareChainsOptions m_compareChainOptions
Definition: ChainSynchronizer.cpp:303
catapult::model::AnnotatedBlockRange
AnnotatedEntityRange< Block > AnnotatedBlockRange
An annotated entity range composed of blocks.
Definition: AnnotatedEntityRange.h:54
Parser.debug
def debug(*args)
Definition: Parser.py:46
BlockChainConfiguration.h
ChainSynchronizer.h
m_sourcePublicKey
Key m_sourcePublicKey
Definition: ChainSynchronizer.cpp:166
m_ranges
std::vector< model::BlockRange > m_ranges
Definition: ChainSynchronizer.cpp:167
RemoteNodeSynchronizer.h
m_spinLock
utils::SpinLock m_spinLock
Definition: ChainSynchronizer.cpp:123
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::thread::compose
auto compose(future< TSeed > &&startFuture, TCreateNextFuture createNextFuture)
Definition: FutureUtils.h:102
catapult::chain::ChainSynchronizerConfiguration::MaxBlocksPerSyncAttempt
uint32_t MaxBlocksPerSyncAttempt
Maximum number of blocks per sync attempt.
Definition: ChainSynchronizer.h:48
catapult::model::AnnotatedEntityRange
Combination of an entity range and optional context.
Definition: AnnotatedEntityRange.h:30
catapult::chain::CompareChains
thread::future< CompareChainsResult > CompareChains(const api::ChainApi &local, const api::ChainApi &remote, const CompareChainsOptions &options)
Compares two chains (local and remote) with the specified options.
Definition: CompareChains.cpp:177
CompareChains.h
catapult::chain::IsRemoteEvil
bool IsRemoteEvil(ChainComparisonCode code)
Gets a value indicating whether or not code indicates that the remote node is evil.
Definition: ChainComparisonCode.cpp:38
m_numBytes
size_t m_numBytes
Definition: ChainSynchronizer.cpp:127
catapult::chain::CompletionAwareBlockRangeConsumerFunc
std::function< disruptor::DisruptorElementId(model::AnnotatedBlockRange &&, const disruptor::ProcessingCompleteFunc &)> CompletionAwareBlockRangeConsumerFunc
Function signature for delivering a block range to a consumer with an additional completion handler.
Definition: ChainSynchronizer.h:43
m_numBlocks
size_t m_numBlocks
Definition: ChainSynchronizer.cpp:165
catapult::disruptor::CompletionStatus
CompletionStatus
Completion status.
Definition: DisruptorTypes.h:38
NumBytes
size_t NumBytes
Definition: ChainSynchronizer.cpp:37
catapult::disruptor::DisruptorElementId
uint64_t DisruptorElementId
Id of a disruptor element.
Definition: DisruptorTypes.h:32
catapult::chain::BlockRangeConsumerFunc
consumer< model::BlockRange && > BlockRangeConsumerFunc
Function signature for delivering a block range to a consumer.
Definition: ChainSynchronizer.h:38
catapult::model::EntityRange::MergeRanges
static EntityRange MergeRanges(std::vector< EntityRange > &&ranges)
Merges all ranges into a single range.
Definition: EntityRange.h:297
m_blockRangeConsumer
CompletionAwareBlockRangeConsumerFunc m_blockRangeConsumer
Definition: ChainSynchronizer.cpp:124
m_hasPendingSync
bool m_hasPendingSync
Definition: ChainSynchronizer.cpp:128
DisruptorTypes.h
m_maxSize
size_t m_maxSize
Definition: ChainSynchronizer.cpp:126
catapult::chain::ChainSynchronizerConfiguration
Configuration for customizing a chain synchronizer.
Definition: ChainSynchronizer.h:46
AnnotatedEntityRange.h
forwardsValidation.info
def info(*args)
Definition: forwardsValidation.py:12
catapult::chain::ChainSynchronizerConfiguration::MaxChainBytesPerSyncAttempt
uint32_t MaxChainBytesPerSyncAttempt
Maximum chain bytes per sync attempt.
Definition: ChainSynchronizer.h:51
catapult::catapult_runtime_error
catapult_error< std::runtime_error > catapult_runtime_error
Definition: exceptions.h:87
CATAPULT_THROW_INVALID_ARGUMENT_1
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)
Macro used to throw a catapult invalid argument with a single parameter.
Definition: exceptions.h:183
catapult::disruptor::ProcessingCompleteFunc
consumer< DisruptorElementId, const ConsumerCompletionResult & > ProcessingCompleteFunc
Function signature for signaling that processing finished.
Definition: DisruptorTypes.h:117
m_elements
std::queue< ElementInfo > m_elements
Definition: ChainSynchronizer.cpp:125
m_blocksFromOptions
api::BlocksFromOptions m_blocksFromOptions
Definition: ChainSynchronizer.cpp:304
catapult::chain::ChainComparisonCode
ChainComparisonCode
Possible chain comparison end states.
Definition: ChainComparisonCode.h:60
catapult::thread::make_ready_future
future< T > make_ready_future(T &&value)
Produces a future that is ready immediately and holds the given value.
Definition: Future.h:126
m_dirty
bool m_dirty
Definition: ChainSynchronizer.cpp:129
Id
disruptor::DisruptorElementId Id
Definition: ChainSynchronizer.cpp:35
catapult::model::BlockRange
EntityRange< Block > BlockRange
An entity range composed of blocks.
Definition: RangeTypes.h:29
catapult::disruptor::CompletionStatus::Normal
Processing of the entity is ongoing.
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::chain::CreateChainSynchronizer
RemoteNodeSynchronizer< api::RemoteChainApi > CreateChainSynchronizer(const std::shared_ptr< const api::ChainApi > &pLocalChainApi, const ChainSynchronizerConfiguration &config, const CompletionAwareBlockRangeConsumerFunc &blockRangeConsumer)
Definition: ChainSynchronizer.cpp:309
catapult::chain::IsRemoteOutOfSync
bool IsRemoteOutOfSync(ChainComparisonCode code)
Gets a value indicating whether or not code indicates that the remote node is out of sync.
Definition: ChainComparisonCode.cpp:34
catapult::chain::CreateRemoteNodeSynchronizer
RemoteNodeSynchronizer< typename TSynchronizer::RemoteApiType > CreateRemoteNodeSynchronizer(const std::shared_ptr< TSynchronizer > &pSynchronizer)
Creates a remote node synchronizer around pSynchronizer.
Definition: RemoteNodeSynchronizer.h:34
catapult::ionet::NodeInteractionResultCode
NodeInteractionResultCode
Possible node interaction result codes.
Definition: NodeInteractionResultCode.h:42
RemoteChainApi.h
catapult::consumer
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
catapult::utils::SpinLockGuard
std::lock_guard< SpinLock > SpinLockGuard
A spin lock guard.
Definition: SpinLock.h:60
RangeTypes.h
EndHeight
Height EndHeight
Definition: ChainSynchronizer.cpp:36