#include <CClockSynchronizer.hpp>
|
typedef std::pair< double,
boost::posix_time::ptime > | DecayingWeight |
| Container for decaying weights. More...
|
|
typedef std::map< MapIndex,
unsigned int > | LastResponseMap |
| Last responses type. More...
|
|
typedef std::pair< std::string,
std::string > | MapIndex |
| Does the i,j referencing. More...
|
|
typedef std::map< MapIndex,
boost::posix_time::time_duration > | OffsetMap |
| Stores the relative offsets. More...
|
|
typedef std::map< MapIndex,
QueryRecord > | QueryMap |
| Stores the outstanding clock queries. More...
|
|
typedef std::pair< unsigned
int, boost::posix_time::ptime > | QueryRecord |
| Query Tuple. More...
|
|
typedef std::list< TimeTuple > | ResponseList |
| Stores the response pairs. More...
|
|
typedef std::map< MapIndex,
ResponseList > | ResponseMap |
| Stores the challenge responses. More...
|
|
typedef std::map< MapIndex,
double > | SkewMap |
| Type used by skews. More...
|
|
typedef std::pair
< boost::posix_time::ptime,
boost::posix_time::ptime > | TimeTuple |
| Tuples of challenge query/response stuff. More...
|
|
typedef std::map< MapIndex,
DecayingWeight > | WeightMap |
| Type used by the weights. More...
|
|
|
static
boost::posix_time::time_duration | DoubleToTD (double td) |
| Turn a double into a time duration. More...
|
|
static ModuleMessage | PrepareForSending (const ClockSynchronizerMessage &message) |
| Wraps a clock synchronizer message in a ModuleMessage. More...
|
|
static double | TDToDouble (boost::posix_time::time_duration td) |
| Turn a time duration into a double. More...
|
|
freedm::broker::CClockSynchronizer::CClockSynchronizer |
( |
boost::asio::io_service & |
ios | ) |
|
|
explicit |
CClockSynchronizer::CClockSynchronizer
- Description:
- Constructs the synchronizer object
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- Read handlers are registered and the synchronizer is ready to begin
- Parameters
-
ios | the broker's ioservice |
ModuleMessage freedm::broker::CClockSynchronizer::CreateExchangeMessage |
( |
unsigned int |
k | ) |
|
|
private |
CClockSynchronizer::ExchangeMessage
- Description:
- Generates the challenge message, which requests a clock reading from another process.
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- None
- Parameters
-
k | A sequence number to use for this request, which is a monotonically increasing value for each receiver |
- Returns
- A prepared exchange message.
ModuleMessage freedm::broker::CClockSynchronizer::CreateExchangeResponse |
( |
unsigned int |
k | ) |
|
|
private |
CClockSynchronizer::ExchangeResponse
- Description:
- Generates the response message. Embeds the current clock reading and the offset table for this process in a message.
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- None
- Parameters
-
k | A sequence number to use for this request, which is a monotonically increasing value for each receiver |
- Returns
- A prepared response message.
boost::posix_time::time_duration freedm::broker::CClockSynchronizer::DoubleToTD |
( |
double |
td | ) |
|
|
staticprivate |
CClockSynchronizer::DoubleToTD
- Description:
- given a double td, convert it to a boost time_duration of roughly the same value (some losses for the accuracy of posix_time
- Precondition:
- None
- Postcondition:
- None
- Parameters
-
td | the time duration (in seconds) to convert |
- Returns
- a time duration that is roughly the same as td.
void freedm::broker::CClockSynchronizer::Exchange |
( |
const boost::system::error_code & |
err | ) |
|
|
private |
CClockSynchronizer::Exchange
- Description:
- Makes clock reading requests to the other processes in the system.
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- The query table is updated and the clock offset / skew is adjusted
- Parameters
-
err | The reason this function was called. |
GetMe
- Description:
- Gets a CPeerNode that refers to this process.
- Returns
- A CPeerNode referring to this process.
boost::posix_time::ptime freedm::broker::CClockSynchronizer::GetSynchronizedTime |
( |
| ) |
const |
CClockSynchronizer::GetSynchronizedTime
- Description:
- Returns the time adjusted by the set offset
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- None
- Returns
- The current time as decided by the synchronization algorithm
std::string IDGIModule::GetUUID |
( |
| ) |
const |
|
protectedinherited |
GetUUID
- Description:
- Gets this process's UUID.
- Returns
- This process's UUID
double freedm::broker::CClockSynchronizer::GetWeight |
( |
MapIndex |
i | ) |
const |
|
private |
CClockSynchronizer::GetWeight
- Description:
- Returns the confidence in the relative offset between 2 nodes
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- None
- Returns
- The weight of a processes clock measurement.
void freedm::broker::CClockSynchronizer::HandleExchange |
( |
const ExchangeMessage & |
msg, |
|
|
CPeerNode |
peer |
|
) |
| |
|
private |
CClockSynchronizer::HandleExchange
- Description:
- Responds to a clock reading request issued by a remote node.
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- An exchange response is sent to the original sender.
- Parameters
-
msg | The message from the remote node |
peer | The peer sending the message. |
void freedm::broker::CClockSynchronizer::HandleExchangeResponse |
( |
const ExchangeResponseMessage & |
msg, |
|
|
CPeerNode |
peer |
|
) |
| |
|
private |
CClockSynchronizer::HandleExchangeResponse
- Description:
- Handles the clock reading response from the remote node
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- Internal tables and state are updated, based on a linear regression created from this response and previous responses.
- Parameters
-
msg | The message from the remote node |
peer | The remote node. |
void freedm::broker::CClockSynchronizer::HandleIncomingMessage |
( |
boost::shared_ptr< const ModuleMessage > |
msg, |
|
|
CPeerNode |
peer |
|
) |
| |
|
virtual |
CClockSyncronizer::HandleIncoming Message
- Description:
- : Takes an incoming message, determines its type and passes it to the appropriate message handler.
- Parameters
-
msg | the incoming message |
peer | the node that sent this message (could be this DGI) |
Implements freedm::broker::IDGIModule.
ModuleMessage freedm::broker::CClockSynchronizer::PrepareForSending |
( |
const ClockSynchronizerMessage & |
message | ) |
|
|
staticprivate |
CClockSynchronizer::PrepareForSending
- Description:
- Wraps a ClockSynchronizerMessage in a ModuleMessage.
- Parameters
-
message | the message to prepare. If any required field is unset, an exception will be thrown. |
- Precondition:
- None
- Postcondition:
- None
- Returns
- a ModuleMessage containing a copy of the ClockSynchronizerMessage
void freedm::broker::CClockSynchronizer::Run |
( |
| ) |
|
CClockSynchronizer::Run()
- Description:
- Schedule's the synchronizer's behavior and starts the synchronization algorithm.
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- The exchange timer is set and the first round will run in QUERY_INTERVAL milliseconds
void freedm::broker::CClockSynchronizer::SetWeight |
( |
MapIndex |
i, |
|
|
double |
w |
|
) |
| |
|
private |
CClockSynchronizer::setWeight
- Description:
- Updates the weights table
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- None
- Parameters
-
i | The weight to update |
w | The amount of weight |
void freedm::broker::CClockSynchronizer::Stop |
( |
| ) |
|
CClockSynchronizer::Stop()
- Description:
- Stops the clock synchronizer.
- Limitations:
- none
- Precondition:
- None
- Postcondition:
- The timer is canceled.
double freedm::broker::CClockSynchronizer::TDToDouble |
( |
boost::posix_time::time_duration |
td | ) |
|
|
staticprivate |
CClockSynchronizer::TDToDouble
- Description:
- give a time duration td, convert it to a double which represents the number of seconds the time duration represents
- Precondition:
- None
- Postcondition:
- None
- Parameters
-
td | the time duration to convert |
- Returns
- a double of the time duration, in seconds.
boost::asio::deadline_timer freedm::broker::CClockSynchronizer::m_exchangetimer |
|
private |
unsigned int freedm::broker::CClockSynchronizer::m_kcounter |
|
private |
boost::posix_time::ptime freedm::broker::CClockSynchronizer::m_lastinteraction |
|
private |
boost::posix_time::time_duration freedm::broker::CClockSynchronizer::m_myoffset |
|
private |
double freedm::broker::CClockSynchronizer::m_myskew |
|
private |
OffsetMap freedm::broker::CClockSynchronizer::m_offsets |
|
private |
QueryMap freedm::broker::CClockSynchronizer::m_queries |
|
private |
ResponseMap freedm::broker::CClockSynchronizer::m_responses |
|
private |
SkewMap freedm::broker::CClockSynchronizer::m_skews |
|
private |
WeightMap freedm::broker::CClockSynchronizer::m_weights |
|
private |
The documentation for this class was generated from the following files: