CatapultServer  v0.5.0.1 (Elephant)
CompareChains.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ChainComparisonCode.h"
23 #include "catapult/api/ChainApi.h"
24 #include "catapult/types.h"
25 
26 namespace catapult { namespace chain {
27 
32  {}
33 
36  CompareChainsOptions(uint32_t maxBlocksToAnalyze, uint32_t maxBlocksToRewrite)
37  : MaxBlocksToAnalyze(maxBlocksToAnalyze)
38  , MaxBlocksToRewrite(maxBlocksToRewrite)
39  {}
40 
43 
46  };
47 
49  uint32_t CalculateMaxHashesToAnalyze(const CompareChainsOptions& options);
50 
55 
58 
60  uint64_t ForkDepth;
61  };
62 
65  const api::ChainApi& local,
66  const api::ChainApi& remote,
67  const CompareChainsOptions& options);
68 }}
FutureUtils.h
m_localHeight
Height m_localHeight
Definition: CompareChains.cpp:172
catapult::chain::CompareChainsOptions::CompareChainsOptions
CompareChainsOptions()
Creates compare-chains options.
Definition: CompareChains.h:31
m_commonBlockHeight
Height m_commonBlockHeight
Definition: CompareChains.cpp:173
m_nextFunctionId
size_t m_nextFunctionId
Definition: CompareChains.cpp:170
m_local
const api::ChainApi & m_local
Definition: CompareChains.cpp:163
catapult::thread::future::then
auto then(TContinuation continuation)
Configures continuation to run at the completion of this future.
Definition: Future.h:59
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::chain::CompareChainsOptions::MaxBlocksToAnalyze
uint32_t MaxBlocksToAnalyze
Maximum number of blocks to analyze.
Definition: CompareChains.h:42
catapult::api::ChainApi
An api for retrieving chain information from a node.
Definition: ChainApi.h:40
m_remote
const api::ChainApi & m_remote
Definition: CompareChains.cpp:164
ChainApi.h
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
ChainComparisonCode.h
CompareChains.h
catapult::chain::CompareChainsOptions::CompareChainsOptions
CompareChainsOptions(uint32_t maxBlocksToAnalyze, uint32_t maxBlocksToRewrite)
Definition: CompareChains.h:36
catapult::chain::CompareChainsOptions::MaxBlocksToRewrite
uint32_t MaxBlocksToRewrite
Maximum number of blocks to rewrite.
Definition: CompareChains.h:45
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::thread::when_all
future< std::vector< future< T > > > when_all(std::vector< future< T >> &&allFutures)
Returns a future that is signaled when all futures in allFutures complete.
Definition: FutureUtils.h:31
catapult::utils::LogLevel::Debug
Level for logging debug events.
catapult::utils::LogLevel::Trace
Level for logging trace events.
catapult::chain::CalculateMaxHashesToAnalyze
uint32_t CalculateMaxHashesToAnalyze(const CompareChainsOptions &options)
Returns max number of hashes to analyze.
Definition: CompareChains.cpp:34
m_comparisonFunctions
ComparisonFunction m_comparisonFunctions[Num_Comparison_Functions]
Definition: CompareChains.cpp:169
catapult::chain::CompareChainsResult::ForkDepth
uint64_t ForkDepth
Depth of the fork that needs to be resolved.
Definition: CompareChains.h:60
catapult::thread::future
Provides a way to access the result of an asynchronous operation.
Definition: Future.h:29
CATAPULT_LOG_LEVEL
#define CATAPULT_LOG_LEVEL(LEVEL)
Writes a log entry to the default logger with LEVEL severity.
Definition: Logging.h:336
catapult::model::HashRange
EntityRange< Hash256 > HashRange
An entity range composed of hashes.
Definition: RangeTypes.h:35
catapult::chain::ChainComparisonCode
ChainComparisonCode
Possible chain comparison end states.
Definition: ChainComparisonCode.h:60
catapult::chain::CompareChainsResult
Result of a chain comparison operation.
Definition: CompareChains.h:52
m_options
CompareChainsOptions m_options
Definition: CompareChains.cpp:165
types.h
Casting.h
catapult::model::FindFirstDifferenceIndex
size_t FindFirstDifferenceIndex(const EntityRange< TEntity > &lhs, const EntityRange< TEntity > &rhs)
Compares two entity ranges (lhs and rhs) and returns the index of the first non-equal element.
Definition: EntityRange.h:524
ChainScore
model::ChainScore ChainScore
Definition: tools/health/main.cpp:43
m_promise
thread::promise< CompareChainsResult > m_promise
Definition: CompareChains.cpp:166
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::chain::CompareChainsResult::Code
ChainComparisonCode Code
End state of the chain comparison operation.
Definition: CompareChains.h:54
catapult::chain::CompareChainsOptions
Options for comparing two chains.
Definition: CompareChains.h:29
BlockUtils.h
catapult::chain::CompareChainsResult::CommonBlockHeight
Height CommonBlockHeight
Height of the last common block between the two chains.
Definition: CompareChains.h:57