CatapultServer  v0.5.0.1 (Elephant)
catapult::timesync Namespace Reference

Namespaces

 filters
 

Classes

struct  CommunicationTimestamps
 Represents the network timestamps for sending and receiving a time synchronization request / response. More...
 
class  ImportanceAwareNodeSelector
 A node selector that selects nodes according to the importance of the account used to boot the node. More...
 
struct  NodeAge_tag
 Node age. More...
 
struct  NodeNetworkTimeRequestPolicy
 Node network time request policy. More...
 
struct  TimeOffset_tag
 Time offset. More...
 
struct  TimeSynchronizationConfiguration
 Time synchronization configuration settings. More...
 
struct  TimeSynchronizationResult
 Information about the result of a time synchronization procedure with a remote node. More...
 
class  TimeSynchronizationSample
 Represents a sample in the time synchronization process. More...
 
class  TimeSynchronizationState
 Time synchronization state. More...
 
class  TimeSynchronizer
 A time synchronizer that synchronizes local time with the network. More...
 

Typedefs

using NodeNetworkTimeRequestor = net::BriefServerRequestor< NodeNetworkTimeRequestPolicy >
 A brief server requestor for requesting node network time information. More...
 
using TimeSynchronizationSamples = std::set< TimeSynchronizationSample >
 A set of time synchronization samples. More...
 
using TimeSyncRequestResultPair = std::pair< net::NodeRequestResult, CommunicationTimestamps >
 Time synchronization request result pair. More...
 
using TimeSyncResultSupplier = std::function< thread::future< TimeSyncRequestResultPair >(const ionet::Node &)>
 Prototype for a time synchronization result supplier. More...
 
using TimeOffset = utils::BaseValue< int64_t, TimeOffset_tag >
 
using NodeAge = utils::BaseValue< int64_t, NodeAge_tag >
 

Enumerations

enum  TimeOffsetDirection : uint8_t { TimeOffsetDirection::Positive = 0, TimeOffsetDirection::Negative = 1 }
 Direction of a time offset. More...
 

Functions

std::shared_ptr< NodeNetworkTimeRequestorCreateNodeNetworkTimeRequestor (const std::shared_ptr< thread::IoThreadPool > &pPool, const crypto::KeyPair &keyPair, const net::ConnectionSettings &settings)
 Creates a node network time requestor for a server with a key pair of keyPair using pPool and configured with settings. More...
 
DECLARE_SERVICE_REGISTRAR() TimeSynchronization (const TimeSynchronizationConfiguration &timeSyncConfig, const std::shared_ptr< TimeSynchronizationState > &pTimeSyncState)
 
thread::future< TimeSynchronizationSamplesRetrieveSamples (const ionet::NodeSet &nodes, const TimeSyncResultSupplier &requestResultFutureSupplier, const NetworkTimeSupplier &networkTimeSupplier)
 
thread::Task CreateTimeSyncTask (TimeSynchronizer &timeSynchronizer, const TimeSynchronizationConfiguration &timeSyncConfig, const TimeSyncResultSupplier &resultSupplier, const extensions::ServiceState &state, TimeSynchronizationState &timeSyncState, const NetworkTimeSupplier &networkTimeSupplier)
 
thread::future< TimeSynchronizationSamplesRetrieveSamples (const ionet::NodeSet &nodes, const TimeSyncResultSupplier &resultSupplier, const extensions::ExtensionManager::NetworkTimeSupplier &networkTimeSupplier)
 
thread::Task CreateTimeSyncTask (TimeSynchronizer &timeSynchronizer, const TimeSynchronizationConfiguration &timeSyncConfig, const TimeSyncResultSupplier &resultSupplier, const extensions::ServiceState &state, TimeSynchronizationState &timeSyncState, const extensions::ExtensionManager::NetworkTimeSupplier &networkTimeSupplier)
 

Variables

constexpr double Coupling_Start = 1.0
 Start value for the coupling of clocks. More...
 
constexpr double Coupling_Minimum = 0.1
 Minimum value for the coupling of clocks. More...
 
constexpr uint64_t Start_Coupling_Decay_After_Round = 5
 Value that indicates the round after which the decay starts. More...
 
constexpr double Coupling_Decay_Strength = 0.3
 Value that indicates the speed of the coupling decay. More...
 
constexpr uint64_t Clock_Adjustment_Threshold = 75
 
constexpr double Required_Minimum_Importance = 0.00025
 
constexpr int64_t Warning_Threshold_Millis = 100
 Minimum offset from remote to local node to trigger logging a warning. More...
 

Typedef Documentation

◆ NodeAge

◆ NodeNetworkTimeRequestor

A brief server requestor for requesting node network time information.

◆ TimeOffset

◆ TimeSynchronizationSamples

A set of time synchronization samples.

◆ TimeSyncRequestResultPair

Time synchronization request result pair.

◆ TimeSyncResultSupplier

Prototype for a time synchronization result supplier.

Enumeration Type Documentation

◆ TimeOffsetDirection

Direction of a time offset.

Enumerator
Positive 

Time offset is in positive direction.

Negative 

Time offset is in negative direction.

Function Documentation

◆ CreateNodeNetworkTimeRequestor()

std::shared_ptr< NodeNetworkTimeRequestor > catapult::timesync::CreateNodeNetworkTimeRequestor ( const std::shared_ptr< thread::IoThreadPool > &  pPool,
const crypto::KeyPair keyPair,
const net::ConnectionSettings settings 
)

Creates a node network time requestor for a server with a key pair of keyPair using pPool and configured with settings.

◆ CreateTimeSyncTask() [1/2]

thread::Task catapult::timesync::CreateTimeSyncTask ( TimeSynchronizer timeSynchronizer,
const TimeSynchronizationConfiguration timeSyncConfig,
const TimeSyncResultSupplier resultSupplier,
const extensions::ServiceState state,
TimeSynchronizationState timeSyncState,
const extensions::ExtensionManager::NetworkTimeSupplier networkTimeSupplier 
)

Creates a time synchronization task around timeSynchronizer, timeSyncConfig, resultSupplier, state, timeSyncState and networkTimeSupplier.

◆ CreateTimeSyncTask() [2/2]

thread::Task catapult::timesync::CreateTimeSyncTask ( TimeSynchronizer timeSynchronizer,
const TimeSynchronizationConfiguration timeSyncConfig,
const TimeSyncResultSupplier resultSupplier,
const extensions::ServiceState state,
TimeSynchronizationState timeSyncState,
const NetworkTimeSupplier &  networkTimeSupplier 
)
Here is the call graph for this function:

◆ RetrieveSamples() [1/2]

thread::future<TimeSynchronizationSamples> catapult::timesync::RetrieveSamples ( const ionet::NodeSet nodes,
const TimeSyncResultSupplier requestResultFutureSupplier,
const NetworkTimeSupplier &  networkTimeSupplier 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RetrieveSamples() [2/2]

thread::future<TimeSynchronizationSamples> catapult::timesync::RetrieveSamples ( const ionet::NodeSet nodes,
const TimeSyncResultSupplier resultSupplier,
const extensions::ExtensionManager::NetworkTimeSupplier networkTimeSupplier 
)

Returns time synchronization samples derived from communication timestamps retrieved from nodes using resultSupplier and networkTimeSupplier.

◆ TimeSynchronization()

DECLARE_SERVICE_REGISTRAR() catapult::timesync::TimeSynchronization ( const TimeSynchronizationConfiguration timeSyncConfig,
const std::shared_ptr< TimeSynchronizationState > &  pTimeSyncState 
)

Creates a registrar for a time synchronization service around timeSyncConfig and pTimeSyncState.

Note
This service is responsible for synchronizing the network time among nodes.

Variable Documentation

◆ Clock_Adjustment_Threshold

constexpr uint64_t catapult::timesync::Clock_Adjustment_Threshold = 75
constexpr

Value that indicates how large the change in network time must be in order to update the node's network time.

Note
This constant is used to prevent slow shifts in network time. The unit of this constant is milliseconds.

◆ Coupling_Decay_Strength

constexpr double catapult::timesync::Coupling_Decay_Strength = 0.3
constexpr

Value that indicates the speed of the coupling decay.

◆ Coupling_Minimum

constexpr double catapult::timesync::Coupling_Minimum = 0.1
constexpr

Minimum value for the coupling of clocks.

◆ Coupling_Start

constexpr double catapult::timesync::Coupling_Start = 1.0
constexpr

Start value for the coupling of clocks.

◆ Required_Minimum_Importance

constexpr double catapult::timesync::Required_Minimum_Importance = 0.00025
constexpr

Minimum importance a node must have in order to be considered as a synchronization partner.

Note
The value corresponds to having a vested balance of 1 NEM stake.

◆ Start_Coupling_Decay_After_Round

constexpr uint64_t catapult::timesync::Start_Coupling_Decay_After_Round = 5
constexpr

Value that indicates the round after which the decay starts.

◆ Warning_Threshold_Millis

constexpr int64_t catapult::timesync::Warning_Threshold_Millis = 100
constexpr

Minimum offset from remote to local node to trigger logging a warning.