GHS
Leader Election Based on GHS Minimum Spanning Tree
Public Member Functions | List of all members
demo::GhsDemoExec Class Reference

The main demo logic for executing le::ghs::GhsState across a network More...

#include <ghs-demo.h>

Public Member Functions

int do_main (int argc, char **argv)
 A single entry point function that should be called from main() More...
 

Detailed Description

The main demo logic for executing le::ghs::GhsState across a network

A configurable multi-agent/multi-process executable built on nng that uses le::ghs::GhsState

Member Function Documentation

◆ do_main()

int demo::GhsDemoExec::do_main ( int  argc,
char **  argv 
)

A single entry point function that should be called from main()

The main loop consists of:

  1. Reading demo::Config information about the peers and their tcp endpoints from an ini file and from stdin
  2. Initializing all the nng sockets inside a demo::Comms object from that config
  3. Using Comms::little_iperf() and Comms::exchange_iperf() to create link metrics
  4. Populating a le::ghs::GhsState object from the Config object and link information gathered by demo::Comms
  5. Calling le::ghs::GhsState::start_round() to get the first set of messages, and feeding those into Comms
  6. Spinning on Comms::has_msg() and calling Comms::get_next() to retrieve a message, then pushing that message payload into le::ghs::GhsState::process() to get the next set of message to send
  7. Continuing that process until le::ghs::GhsState::is_converged() returns true
  8. Printing stuff

If you want to replicate this, study this loop, and pay close attention to how little_iperf() does its work and especially sym_metric().

See also
demo::Config
le::ghs::GhsState
le::ghs::Msg
demo::WireMessage
sym_metric()

The documentation for this class was generated from the following file: