|
GHS
Leader Election Based on GHS Minimum Spanning Tree
|
Classes | |
| struct | Edge |
| A struct to hold all the communication edge information. More... | |
| class | GhsState |
| The main state machine for the GHS algorithm More... | |
| class | Msg |
| An aggregate type containing all the data to exchange with to/from information. More... | |
Typedefs | |
| typedef int | agent_t |
| problems for GhsState More... | |
| typedef unsigned long | metric_t |
| typedef int | level_t |
| A "level" which is an internal item for GhsState to track how many times the MST has merged with another. | |
Enumerations | |
| enum | status_t { UNKNOWN = 0, MST = 1, MST_PARENT =2, DELETED =-1 } |
| A status enumeration, for the ghs edges. More... | |
Functions | |
| bool | is_valid (const agent_t a) |
| Edge | worst_edge () |
| bool | is_valid (const Edge e) |
| bool | is_valid (const metric_t m) |
Variables | |
| const agent_t | NO_AGENT =-1 |
| const metric_t | WORST_METRIC =std::numeric_limits<metric_t>::max() |
| const metric_t | METRIC_NOT_SET =0 |
| const level_t | LEVEL_START =0 |
| All levels start at 0. | |
| const unsigned int | MAX_MSG_SZ = sizeof(Msg) |
GHS
The GHS namespace
problems for GhsState
The ghs implementation supports arbitrary integers, as long as they are greater than or equal to zero. Use is_valid() to ensure an agent_t will
| typedef unsigned long le::ghs::metric_t |
A typedef to hold the metrics. There's some work to do to make sure the metrics are:
However, that is not captured here, and is handled at a "higher level". See unique_link_metric_to()
| enum le::ghs::status_t |
A status enumeration, for the ghs edges.
| bool le::ghs::is_valid | ( | const agent_t | a | ) |
Just in case you want an official alias for a>=0.
| bool le::ghs::is_valid | ( | const Edge | e | ) |
| e | an Edge |
| bool le::ghs::is_valid | ( | const metric_t | m | ) |
| m | a metric_t |
NOT_SET or WORST_METRIC | Edge le::ghs::worst_edge | ( | ) |
Returns the worst possible edge, useful for comparisons in the search for the minimum weight outgoing edge.
| const unsigned int le::ghs::MAX_MSG_SZ = sizeof(Msg) |
| const metric_t le::ghs::METRIC_NOT_SET =0 |
This is set to zero because metrics are usually zero initialized by default, and we do not want to have a bunch of zeros floating around in our search
| const agent_t le::ghs::NO_AGENT =-1 |
This means not set
This is the "worst" metric possible, defined simply as the maximum value reachable.
We all need to agree on the worst metric, since we're all comparing against this to determine if we found a minimum weight outgoing edge. See mwoe()
1.8.17