FREEDM DGI
|
Declaration of Garcia-Molina Invitation Leader Election algorithm.
#include <GroupManagement.hpp>
Public Types | |
enum | { NORMAL, DOWN, RECOVERY, REORGANIZATION, ELECTION } |
Module states. More... | |
Public Member Functions | |
GMAgent () | |
Constructor for using this object as a module. More... | |
~GMAgent () | |
Module destructor. More... | |
int | Run () |
Called to start the system. More... | |
Static Public Member Functions | |
static PeerSet | ProcessPeerList (const PeerListMessage &msg) |
Handles Processing a PeerList. More... | |
Protected Member Functions | |
CPeerNode | GetMe () |
Gets a CPeerNode representing this process. More... | |
std::string | GetUUID () const |
Gets the UUID of this process. More... | |
Private Member Functions | |
ModuleMessage | Accept () |
Creates an Accept Message. More... | |
CPeerNode | AddPeer (std::string uuid) |
Adds a peer to the peer set from UUID. More... | |
CPeerNode | AddPeer (CPeerNode peer) |
Adds a peer from a pointer to a peer node object. More... | |
ModuleMessage | AreYouCoordinator () |
Creates AYC Message. More... | |
ModuleMessage | AreYouCoordinatorResponse (std::string payload, int seq) |
Creates A Response message. More... | |
ModuleMessage | AreYouThere () |
Creates a AYT, used for Timeout. More... | |
ModuleMessage | AreYouThereResponse (std::string payload, int seq) |
Creates A Response message. More... | |
void | Check (const boost::system::error_code &err) |
Checks for other up leaders. More... | |
std::string | Coordinator () const |
Returns the coordinators uuid. More... | |
CPeerNode | GetPeer (const std::string &uuid) |
Gets a pointer to a peer from UUID. More... | |
int | GetStatus () const |
Gets the status of a node. More... | |
void | HandleAccept (const AcceptMessage &msg, CPeerNode peer) |
Handles recieving accept messsages. More... | |
void | HandleAreYouCoordinator (const AreYouCoordinatorMessage &msg, CPeerNode peer) |
Handles recieving are you coordinator messages. More... | |
void | HandleAreYouThere (const AreYouThereMessage &msg, CPeerNode peer) |
Handles recieving are you there messsages. More... | |
void | HandleIncomingMessage (boost::shared_ptr< const ModuleMessage > msg, CPeerNode peer) |
Handles received messages. More... | |
void | HandleInvite (const InviteMessage &msg, CPeerNode peer) |
Handles recieving invite messages. More... | |
void | HandlePeerList (const PeerListMessage &msg, CPeerNode peer) |
Hadles recieving peerlists. More... | |
void | HandlePeerListQuery (const PeerListQueryMessage &msg, CPeerNode peer) |
Handles recieving peerlist requests. More... | |
void | HandleResponseAYC (const AreYouCoordinatorResponseMessage &msg, CPeerNode peer) |
Handles recieving AYC responses. More... | |
void | HandleResponseAYT (const AreYouThereResponseMessage &msg, CPeerNode peere) |
Handles recieving AYT responses. More... | |
ModuleMessage | Invitation () |
Creates Group Invitation Message. More... | |
void | InviteGroupNodes (const boost::system::error_code &err, PeerSet p_tempSet) |
Sends invitations to all group members. More... | |
bool | IsCoordinator () const |
Returns true if this node considers itself a coordinator. More... | |
void | Merge (const boost::system::error_code &err) |
Sends invitations to all known nodes. More... | |
ModuleMessage | PeerList (std::string requester="all") |
Generates a peer list. More... | |
void | Premerge (const boost::system::error_code &err) |
Waits a time period determined by UUID for merge. More... | |
void | PushPeerList () |
Sends the peer list to all group members. More... | |
void | Recovery () |
Resets the algorithm to the default startup state. More... | |
void | Recovery (const boost::system::error_code &err) |
Handles no response from timeout message. More... | |
void | Reorganize (const boost::system::error_code &err) |
Puts the system into the working state. More... | |
void | SetStatus (int status) |
Sets the status of the node. More... | |
void | StartMonitor (const boost::system::error_code &err) |
Start the monitor after transient is over. More... | |
void | SystemState () |
Outputs information about the current state to the logger. More... | |
void | Timeout (const boost::system::error_code &err) |
Checks that the leader is still alive and working. More... | |
Static Private Member Functions | |
static ModuleMessage | PeerListQuery (std::string requester) |
Generates a CMessage that can be used to query for the group. More... | |
static ModuleMessage | PrepareForSending (const GroupManagementMessage &message, std::string recipient="gm") |
Wraps a GroupManagementMessage in a ModuleMessage. More... | |
Private Attributes | |
boost::posix_time::time_duration | AYC_RESPONSE_TIMEOUT |
How long to wait for responses from other nodes. More... | |
boost::posix_time::time_duration | AYT_RESPONSE_TIMEOUT |
How long to wait for responses from other nodes. More... | |
boost::posix_time::time_duration | CHECK_TIMEOUT |
How long between AYC checks. More... | |
boost::posix_time::time_duration | FID_TIMEOUT |
How long to wait before checking attached FIDs. More... | |
boost::posix_time::time_duration | INVITE_RESPONSE_TIMEOUT |
How long to wait for responses from other nodes. More... | |
TimedPeerSet | m_AYCResponse |
Nodes expecting AYC response from. More... | |
TimedPeerSet | m_AYTResponse |
Nodes expecting AYT response from. More... | |
PeerSet | m_Coordinators |
Known Coordinators. More... | |
std::map< std::string, bool > | m_fidstate |
A store for the state of attached FIDs. More... | |
CBroker::TimerHandle | m_fidtimer |
Timer for checking FIDs. More... | |
google::protobuf::uint32 | m_GroupID |
The ID number of the current group (Never initialized for fun) More... | |
std::string | m_GroupLeader |
The uuid of the group leader. More... | |
int | m_groupsbroken |
Number of groups broken. More... | |
int | m_groupselection |
Number of elections started. More... | |
int | m_groupsformed |
Number of groups formed. More... | |
int | m_groupsjoined |
Number of accepts sent. More... | |
unsigned int | m_GrpCounter |
The number of groups being formed. More... | |
boost::asio::io_service | m_localservice |
The io_service used. More... | |
int | m_membership |
Total size of groups after all checks. More... | |
int | m_membershipchecks |
Number of membership checks. More... | |
int | m_status |
A store for the status of this node. More... | |
CBroker::TimerHandle | m_timer |
A timer for stepping through the election process. More... | |
PeerSet | m_UpNodes |
Nodes In My Group. More... | |
boost::posix_time::time_duration | TIMEOUT_TIMEOUT |
How long beteween AYT checks. More... | |
freedm::broker::gm::GMAgent::GMAgent | ( | ) |
freedm::broker::gm::GMAgent::~GMAgent | ( | ) |
|
private |
|
private |
uuid | of the peer to add. |
peer | a pointer to a peer. |
|
private |
|
private |
GMAgent::AreYouCoordinatorResponse
payload | Response message (typically yes or no) |
seq | sequence number? (?) |
|
private |
|
private |
payload | Response message (typically yes or no) |
seq | sequence number? (?) |
|
private |
err | Error associated with calling timer. |
|
inlineprivate |
|
protectedinherited |
|
private |
uuid | The uuid of the peer to fetch |
|
private |
|
protectedinherited |
GetUUID
|
private |
|
private |
GMAgent::HandleAreYouCoordinator
|
private |
|
privatevirtual |
"Downcasts" incoming messages into a specific message type, and passes the message to an appropriate handler.
msg | the incoming message |
peer | the node that sent this message (could be this DGI) |
Implements freedm::broker::IDGIModule.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
err | The error message associated with the calling thimer |
p_tempSet | The set of nodes that were members of the old group. |
|
inlineprivate |
|
private |
err | A error associated with the calling timer. |
|
private |
|
staticprivate |
requester | The module who the response should be addressed to. |
|
private |
err | An error associated with the clling timer. |
|
staticprivate |
Wraps a GroupManagementMessage in a ModuleMessage.
message | the message to prepare. If any required field is unset, the DGI will abort. |
recipient | the module (sc/lb/gm/clk etc.) the message should be delivered to |
|
static |
msg | The message to parse |
|
private |
|
private |
|
private |
err | The error code associated with the calling timer. |
|
private |
int freedm::broker::gm::GMAgent::Run | ( | ) |
|
private |
status | The status code to set |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |