MADARA
3.4.1
|
Holds basic transport settings. More...
#include <TransportSettings.h>
Public Types | |
typedef std::vector< std::string > | Voters |
Public Member Functions | |
TransportSettings ()=default | |
Constructor for this class. More... | |
TransportSettings (const TransportSettings &settings) | |
Copy constructor. More... | |
virtual | ~TransportSettings () |
void | add_host (const std::string &host) |
Safely add hosts to the settings. More... | |
void | add_read_domain (const std::string &domain) |
Adds a read domain to the list of domains to read from. More... | |
void | clear_hosts (void) |
Safely clears hosts from the settings. More... | |
void | clear_read_domains (void) |
Clears the list of read domains. More... | |
void | debug_to_kb (const std::string &prefix=".transport") |
Requests all debugging for threads go into the data plane KB instead of the control plane. More... | |
void | get_read_domains (std::vector< std::string > &domains) const |
Retrieves the list of read domains. More... | |
bool | is_reading_domain (const std::string domain) const |
Checks if a domain is in the domain read list. More... | |
virtual void | load (const std::string &filename, const std::string &prefix="transport") |
Loads the settings from a binary file. More... | |
virtual void | load_text (const std::string &filename, const std::string &prefix="transport") |
Loads the settings from a text file. More... | |
size_t | num_read_domains (void) const |
Returns the number of read domains. More... | |
void | operator= (const TransportSettings &settings) |
Assignment operator. More... | |
virtual void | save (const std::string &filename, const std::string &prefix="transport") const |
Saves the settings from a binary file. More... | |
virtual void | save_text (const std::string &filename, const std::string &prefix="transport") const |
Saves the settings from a text file. More... | |
Public Attributes | |
std::string | debug_to_kb_prefix = "" |
if not empty, save debug information to knowledge base at prefix More... | |
bool | delay_launch = false |
Delay launching transports until explicit activate call. More... | |
OriginatorFragmentMap | fragment_map |
Map of fragments received by originator. More... | |
uint32_t | fragment_queue_length = 100 |
Indicates queue length for holding clock-keyed fragments. More... | |
std::vector< std::string > | hosts |
Host information for transports that require it. More... | |
uint32_t | id = 0 |
The id of this process (DEPRECATED). You do not need to set this. More... | |
uint32_t | max_fragment_size = 62000 |
Maximum allowed fragment size for partitioning large messages. More... | |
double | max_send_hertz = 0.0 |
Maximum rate of sending messages. More... | |
bool | never_exit = false |
Prevent MADARA from exiting on fatal errors and invalid state. More... | |
bool | no_receiving = false |
if true, never receive over transport More... | |
bool | no_sending = false |
if true, never send over transport More... | |
std::string | on_data_received_logic |
Logic to be evaluated after every successful update. More... | |
uint32_t | processes = 1 |
Number of processes (DEPRECATED). You do not need to set this. More... | |
uint32_t | queue_length = DEFAULT_QUEUE_LENGTH |
Length of the buffer used to store history of events. More... | |
double | read_thread_hertz = 1000.0 |
Number of valid messages allowed to be received per second. More... | |
uint32_t | read_threads = 1 |
the number of read threads to start More... | |
uint32_t | reliability = DEFAULT_RELIABILITY |
Reliability required of the transport. More... | |
int | resend_attempts = 10 |
Maximum number of attempts to resend if transport is busy. More... | |
bool | send_history = false |
if true, send all updates since last send, for records that have history enabled (if the history capacity was exceeded since last send, the oldest updates are lost). More... | |
bool | send_reduced_message_header = false |
Send a reduced message header (clock, size, updates, KaRL id) More... | |
double | slack_time = 0 |
Time to sleep between sends and rebroadcasts. More... | |
uint32_t | type = DEFAULT_TRANSPORT |
Type of transport. See madara::transport::Types for options. More... | |
std::string | write_domain = "KaRL" |
All class members are accessible to users for easy setup. More... | |
Static Public Attributes | |
static const uint32_t | DEFAULT_DEADLINE = 0 |
Default deadline. More... | |
static const uint32_t | DEFAULT_QUEUE_LENGTH = 500000 |
Default queue length for event history (must be high for reliable transport. More... | |
static const uint32_t | DEFAULT_RELIABILITY = RELIABLE |
Default reliability. More... | |
static const uint32_t | DEFAULT_TRANSPORT = NO_TRANSPORT |
Default transport. More... | |
Private Attributes | |
std::map< std::string, int > | read_domains_ |
Any acceptable read domain is added here. More... | |
Friends | |
class | Base |
Holds basic transport settings.
Definition at line 79 of file TransportSettings.h.
typedef std::vector<std::string> madara::transport::TransportSettings::Voters |
Definition at line 88 of file TransportSettings.h.
|
default |
Constructor for this class.
madara::transport::TransportSettings::TransportSettings | ( | const TransportSettings & | settings | ) |
Copy constructor.
Definition at line 57 of file TransportSettings.cpp.
|
virtual |
Definition at line 124 of file TransportSettings.cpp.
void madara::transport::TransportSettings::add_host | ( | const std::string & | host | ) |
Safely add hosts to the settings.
If you are unsure if the user application and the library will be compiled with the same STL implementation for strings and vectors, this function combined with the clear_hosts function are safe ways to force the MADARA library to contain the full implementations of deallocation.
host | host to add to the list |
Definition at line 139 of file TransportSettings.cpp.
|
inline |
Adds a read domain to the list of domains to read from.
domain | domain to add to the read list |
Definition at line 13 of file TransportSettings.inl.
void madara::transport::TransportSettings::clear_hosts | ( | void | ) |
Safely clears hosts from the settings.
If you are unsure if the user application and the library will be compiled with the same STL implementation for strings and vectors, this function provides a safe way to clear the vector of strings.
Definition at line 145 of file TransportSettings.cpp.
|
inline |
Clears the list of read domains.
Definition at line 19 of file TransportSettings.inl.
|
inline |
Requests all debugging for threads go into the data plane KB instead of the control plane.
This will impact performance of your main knowledge base, so you should use it sparingly, if possible.
prefix | prefix to save debug info into data plane KB |
Definition at line 24 of file TransportSettings.inl.
|
inline |
Retrieves the list of read domains.
domains | the list to fill with all read domains |
Definition at line 30 of file TransportSettings.inl.
|
inline |
Checks if a domain is in the domain read list.
domain | domain to check |
Definition at line 41 of file TransportSettings.inl.
|
virtual |
Loads the settings from a binary file.
filename | the file to load from |
prefix | prefix for all transports settings |
Reimplemented in madara::transport::QoSTransportSettings.
Definition at line 150 of file TransportSettings.cpp.
|
virtual |
Loads the settings from a text file.
filename | the file to load from |
prefix | prefix for all transports settings |
Reimplemented in madara::transport::QoSTransportSettings.
Definition at line 294 of file TransportSettings.cpp.
|
inline |
Returns the number of read domains.
Definition at line 47 of file TransportSettings.inl.
void madara::transport::TransportSettings::operator= | ( | const TransportSettings & | settings | ) |
Assignment operator.
Definition at line 88 of file TransportSettings.cpp.
|
virtual |
Saves the settings from a binary file.
filename | the file to load from |
prefix | prefix for all transports settings |
Reimplemented in madara::transport::QoSTransportSettings.
Definition at line 449 of file TransportSettings.cpp.
|
virtual |
Saves the settings from a text file.
filename | the file to load from |
prefix | prefix for all transports settings |
Reimplemented in madara::transport::QoSTransportSettings.
Definition at line 501 of file TransportSettings.cpp.
|
friend |
Definition at line 83 of file TransportSettings.h.
std::string madara::transport::TransportSettings::debug_to_kb_prefix = "" |
if not empty, save debug information to knowledge base at prefix
Definition at line 330 of file TransportSettings.h.
|
static |
Default deadline.
Definition at line 95 of file TransportSettings.h.
|
static |
Default queue length for event history (must be high for reliable transport.
Definition at line 92 of file TransportSettings.h.
|
static |
Default reliability.
Definition at line 101 of file TransportSettings.h.
|
static |
Default transport.
Definition at line 98 of file TransportSettings.h.
bool madara::transport::TransportSettings::delay_launch = false |
Delay launching transports until explicit activate call.
Definition at line 273 of file TransportSettings.h.
|
mutable |
Map of fragments received by originator.
Definition at line 282 of file TransportSettings.h.
uint32_t madara::transport::TransportSettings::fragment_queue_length = 100 |
Indicates queue length for holding clock-keyed fragments.
Note that this does not limit the number of fragments–only how many clock values we want to queue for defragmentation. So, if you have a fragment_queue_length of 3, and your last three received fragmented clock values were 1=4GB, 2=4GB, 3=4GB, then you could have 12GB, regardless of max_fragment_size.
Definition at line 257 of file TransportSettings.h.
std::vector<std::string> madara::transport::TransportSettings::hosts |
Host information for transports that require it.
The format of these is transport specific, but for UDP, you might have "localhost:1234" for a host named localhost and a port of 1234. See the specific transport for more information.
Definition at line 308 of file TransportSettings.h.
uint32_t madara::transport::TransportSettings::id = 0 |
The id of this process (DEPRECATED). You do not need to set this.
Definition at line 264 of file TransportSettings.h.
uint32_t madara::transport::TransportSettings::max_fragment_size = 62000 |
Maximum allowed fragment size for partitioning large messages.
Definition at line 244 of file TransportSettings.h.
double madara::transport::TransportSettings::max_send_hertz = 0.0 |
Maximum rate of sending messages.
This is not a bandwidth limit. This specifically limits the number of times the transport can send in a second. Under the hood, it is causing the transport to enforce sleeps between sends to provide time for the OS or transport to recover. May be especially useful to UDP transports.
Definition at line 300 of file TransportSettings.h.
bool madara::transport::TransportSettings::never_exit = false |
Prevent MADARA from exiting on fatal errors and invalid state.
Definition at line 276 of file TransportSettings.h.
bool madara::transport::TransportSettings::no_receiving = false |
if true, never receive over transport
Definition at line 318 of file TransportSettings.h.
bool madara::transport::TransportSettings::no_sending = false |
if true, never send over transport
Definition at line 313 of file TransportSettings.h.
std::string madara::transport::TransportSettings::on_data_received_logic |
Logic to be evaluated after every successful update.
Definition at line 270 of file TransportSettings.h.
uint32_t madara::transport::TransportSettings::processes = 1 |
Number of processes (DEPRECATED). You do not need to set this.
Definition at line 267 of file TransportSettings.h.
uint32_t madara::transport::TransportSettings::queue_length = DEFAULT_QUEUE_LENGTH |
Length of the buffer used to store history of events.
For almost all transports, this is the buffer size used by the operating system and transport layer. You should set this to essentially be enough to hold at least 1 second-worth of data. So, if you sending 1KB of data at 1khz, you need at least 1MB and possibly 5MB to have smooth delivery that can handle operating system busy periods without losing too much data.
Definition at line 238 of file TransportSettings.h.
|
private |
Any acceptable read domain is added here.
Definition at line 336 of file TransportSettings.h.
double madara::transport::TransportSettings::read_thread_hertz = 1000.0 |
Number of valid messages allowed to be received per second.
This value can be -1 or 0.0 to go as fast as possible
Definition at line 291 of file TransportSettings.h.
uint32_t madara::transport::TransportSettings::read_threads = 1 |
the number of read threads to start
Definition at line 227 of file TransportSettings.h.
uint32_t madara::transport::TransportSettings::reliability = DEFAULT_RELIABILITY |
Reliability required of the transport.
See madara::transport::Reliabilities for options
Definition at line 261 of file TransportSettings.h.
int madara::transport::TransportSettings::resend_attempts = 10 |
Maximum number of attempts to resend if transport is busy.
Definition at line 247 of file TransportSettings.h.
bool madara::transport::TransportSettings::send_history = false |
if true, send all updates since last send, for records that have history enabled (if the history capacity was exceeded since last send, the oldest updates are lost).
Definition at line 325 of file TransportSettings.h.
bool madara::transport::TransportSettings::send_reduced_message_header = false |
Send a reduced message header (clock, size, updates, KaRL id)
Definition at line 279 of file TransportSettings.h.
double madara::transport::TransportSettings::slack_time = 0 |
Time to sleep between sends and rebroadcasts.
Definition at line 285 of file TransportSettings.h.
uint32_t madara::transport::TransportSettings::type = DEFAULT_TRANSPORT |
Type of transport. See madara::transport::Types for options.
Definition at line 241 of file TransportSettings.h.
std::string madara::transport::TransportSettings::write_domain = "KaRL" |
All class members are accessible to users for easy setup.
We only write to one domain
Definition at line 224 of file TransportSettings.h.