coral
A C++ library for distributed co-simulation
|
A common communication interface to a cluster of slave providers. More...
#include "coral/master/cluster.hpp"
Classes | |
struct | SlaveType |
Information about a slave type. More... | |
Public Member Functions | |
ProviderCluster (const coral::net::ip::Address &networkInterface, coral::net::ip::Port discoveryPort) | |
Constructor. More... | |
~ProviderCluster () CORAL_NOEXCEPT | |
Destructor. | |
ProviderCluster (ProviderCluster &&) CORAL_NOEXCEPT | |
Move constructor. | |
ProviderCluster & | operator= (ProviderCluster &&) CORAL_NOEXCEPT |
Move assignment operator. | |
std::vector< SlaveType > | GetSlaveTypes (std::chrono::milliseconds timeout) |
Returns the slave types which are offered by all slave providers discovered so far. More... | |
coral::net::SlaveLocator | InstantiateSlave (const std::string &slaveProviderID, const std::string &slaveTypeUUID, std::chrono::milliseconds timeout) |
Requests that a slave be spawned by a specific slave provider. More... | |
A common communication interface to a cluster of slave providers.
This class represents a common interface to several slave providers in a network. It can be used to get information about the available slave types and to instantiate slaves on specific providers.
Slave providers are discovered automatically by listening for UDP broadcast messages that they broadcast periodically.
coral::master::ProviderCluster::ProviderCluster | ( | const coral::net::ip::Address & | networkInterface, |
coral::net::ip::Port | discoveryPort | ||
) |
Constructor.
[in] | networkInterface | The name or IP address of the network interface that should be used, or "*" for all available interfaces. |
[in] | discoveryPort | The UDP port used for discovering other entities such as slave providers. |
std::vector<SlaveType> coral::master::ProviderCluster::GetSlaveTypes | ( | std::chrono::milliseconds | timeout | ) |
Returns the slave types which are offered by all slave providers discovered so far.
[in] | timeout | The communications timeout used to detect loss of communication with slave providers. A negative value means no timeout. |
coral::net::SlaveLocator coral::master::ProviderCluster::InstantiateSlave | ( | const std::string & | slaveProviderID, |
const std::string & | slaveTypeUUID, | ||
std::chrono::milliseconds | timeout | ||
) |
Requests that a slave be spawned by a specific slave provider.
timeout
specifies how long the slave provider should wait for the slave to start up before assuming it has crashed or frozen. The function will wait twice as long as this for the slave provider to report that the slave has been successfully instantiated before it assumes that the slave provider itself has crashed or the connection has been lost. In both cases, an exception is thrown.
[in] | slaveProviderID | The ID of the slave provider that should instantiate the slave. |
[in] | slaveTypeUUID | The UUID that identifies the type of the slave that is to be instantiated. |
[in] | timeout | How much time the slave gets to start up. A negative value means no limit. |
Execution::Reconstitute()
.