CatapultServer  v0.5.0.1 (Elephant)
TimeSynchronizer.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "constants.h"
23 #include "types.h"
25 
26 namespace catapult {
27  namespace cache {
28  class AccountStateCacheView;
29  class ImportanceView;
30  }
31 }
32 
33 namespace catapult { namespace timesync {
34 
37  public:
39  explicit TimeSynchronizer(
41  Importance totalChainImportance,
42  int64_t warningThresholdMillis = Warning_Threshold_Millis);
43 
44  public:
47  const cache::AccountStateCacheView& accountStateCacheView,
48  Height height,
50  NodeAge nodeAge);
51 
52  private:
54  const cache::ImportanceView& importanceView,
55  Height height,
56  const TimeSynchronizationSamples& samples);
57 
58  double sumScaledOffsets(
59  const cache::ImportanceView& importanceView,
60  Height height,
61  const TimeSynchronizationSamples& samples,
62  double scaling);
63  private:
67  };
68 }}
catapult::timesync::TimeSynchronizer::m_totalChainImportance
Importance m_totalChainImportance
Definition: TimeSynchronizer.h:65
constants.h
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
catapult::utils::BasicBaseValue< uint64_t, Importance_tag, BaseValue< uint64_t, Importance_tag > >::ValueType
uint64_t ValueType
Raw value type.
Definition: BaseValue.h:33
catapult::timesync::TimeSynchronizer
A time synchronizer that synchronizes local time with the network.
Definition: TimeSynchronizer.h:36
colorPrint.warning
def warning(*args)
Definition: colorPrint.py:10
catapult::timesync::TimeSynchronizer::m_warningThresholdMillis
int64_t m_warningThresholdMillis
Definition: TimeSynchronizer.h:66
catapult::timesync::Coupling_Minimum
constexpr double Coupling_Minimum
Minimum value for the coupling of clocks.
Definition: extensions/timesync/src/constants.h:30
catapult::utils::BasicBaseValue::unwrap
constexpr ValueType unwrap() const
Unwraps this value and returns the underlying raw value.
Definition: BaseValue.h:53
catapult::timesync::NodeAge
utils::BaseValue< int64_t, NodeAge_tag > NodeAge
Definition: extensions/timesync/src/types.h:32
catapult::utils::BaseValue< uint64_t, Importance_tag >
catapult::utils::Sum
auto Sum(const TContainer &container, TFunction accessor)
Definition: Functional.h:39
AccountStateCacheView.h
catapult::timesync::filters::AggregateSynchronizationFilter
Aggregate synchronization filter.
Definition: AggregateSynchronizationFilter.h:29
catapult::utils::LogLevel::Trace
Level for logging trace events.
catapult::timesync::Coupling_Start
constexpr double Coupling_Start
Start value for the coupling of clocks.
Definition: extensions/timesync/src/constants.h:27
catapult::timesync::Warning_Threshold_Millis
constexpr int64_t Warning_Threshold_Millis
Minimum offset from remote to local node to trigger logging a warning.
Definition: extensions/timesync/src/constants.h:47
Functional.h
catapult::utils::LogLevel
LogLevel
Catapult log levels.
Definition: Logging.h:36
catapult::timesync::TimeSynchronizationSamples
std::set< TimeSynchronizationSample > TimeSynchronizationSamples
A set of time synchronization samples.
Definition: TimeSynchronizationSample.h:83
catapult::timesync::Coupling_Decay_Strength
constexpr double Coupling_Decay_Strength
Value that indicates the speed of the coupling decay.
Definition: extensions/timesync/src/constants.h:36
catapult::timesync::TimeSynchronizer::TimeSynchronizer
TimeSynchronizer(const filters::AggregateSynchronizationFilter &filter, Importance totalChainImportance, int64_t warningThresholdMillis=Warning_Threshold_Millis)
Creates a time synchronizer around filter, totalChainImportance and warningThresholdMillis.
Definition: TimeSynchronizer.cpp:42
catapult::timesync::TimeSynchronizer::m_filter
filters::AggregateSynchronizationFilter m_filter
Definition: TimeSynchronizer.h:64
CATAPULT_LOG_LEVEL
#define CATAPULT_LOG_LEVEL(LEVEL)
Writes a log entry to the default logger with LEVEL severity.
Definition: Logging.h:336
catapult::timesync::TimeSynchronizer::calculateTimeOffset
TimeOffset calculateTimeOffset(const cache::AccountStateCacheView &accountStateCacheView, Height height, TimeSynchronizationSamples &&samples, NodeAge nodeAge)
Calculates a time offset from samples using accountStateCacheView, height and nodeAge.
Definition: TimeSynchronizer.cpp:51
catapult::cache::ReadOnlyViewSupplier::asReadOnly
const TView::ReadOnlyView & asReadOnly() const
Returns a read-only view of this view.
Definition: ReadOnlyViewSupplier.h:46
filter_constants.h
catapult::timesync::filters::Start_Decay_After_Round
constexpr int64_t Start_Decay_After_Round
Value that indicates after which round the decay starts.
Definition: filter_constants.h:34
catapult::timesync::TimeOffset
utils::BaseValue< int64_t, TimeOffset_tag > TimeOffset
Definition: extensions/timesync/src/types.h:28
AggregateSynchronizationFilter.h
catapult
Definition: AddressExtractionExtension.cpp:28
TimeSynchronizer.h
types.h
catapult::timesync::TimeSynchronizer::sumImportances
Importance::ValueType sumImportances(const cache::ImportanceView &importanceView, Height height, const TimeSynchronizationSamples &samples)
Definition: TimeSynchronizer.cpp:77
catapult::validators::MapToLogLevel
constexpr utils::LogLevel MapToLogLevel(ValidationResult result)
Maps validation result to an appropriate logging level.
Definition: ValidationResult.h:100
ImportanceView.h
catapult::cache::AccountStateCacheView
View on top of the account state cache.
Definition: AccountStateCacheView.h:110
catapult::timesync::TimeSynchronizer::sumScaledOffsets
double sumScaledOffsets(const cache::ImportanceView &importanceView, Height height, const TimeSynchronizationSamples &samples, double scaling)
Definition: TimeSynchronizer.cpp:86
catapult::utils::LogLevel::Warning
Level for logging warning events.
catapult::cache::ImportanceView
A view on top of an account state cache for retrieving importances.
Definition: ImportanceView.h:29
catapult::cache::ImportanceView::getAccountImportanceOrDefault
Importance getAccountImportanceOrDefault(const Key &publicKey, Height height) const
Gets the importance for publicKey at height or a default importance if no importance is set.
Definition: ImportanceView.cpp:76
catapult::cache::BasicAccountStateCacheView::highValueAddresses
const model::AddressSet & highValueAddresses() const
Gets all high value addresses.
Definition: AccountStateCacheView.cpp:73