MADARA  3.4.1
madara::transport::TransportSettings Class Reference

Holds basic transport settings. More...

#include <TransportSettings.h>

Inheritance diagram for madara::transport::TransportSettings:
madara::transport::QoSTransportSettings

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
 

Detailed Description

Holds basic transport settings.

Definition at line 79 of file TransportSettings.h.

Member Typedef Documentation

◆ Voters

typedef std::vector<std::string> madara::transport::TransportSettings::Voters

Definition at line 88 of file TransportSettings.h.

Constructor & Destructor Documentation

◆ TransportSettings() [1/2]

madara::transport::TransportSettings::TransportSettings ( )
default

Constructor for this class.

◆ TransportSettings() [2/2]

madara::transport::TransportSettings::TransportSettings ( const TransportSettings settings)

Copy constructor.

Definition at line 57 of file TransportSettings.cpp.

◆ ~TransportSettings()

madara::transport::TransportSettings::~TransportSettings ( )
virtual

Definition at line 124 of file TransportSettings.cpp.

Member Function Documentation

◆ add_host()

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.

Parameters
hosthost to add to the list

Definition at line 139 of file TransportSettings.cpp.

◆ add_read_domain()

void madara::transport::TransportSettings::add_read_domain ( const std::string &  domain)
inline

Adds a read domain to the list of domains to read from.

Parameters
domaindomain to add to the read list

Definition at line 13 of file TransportSettings.inl.

◆ clear_hosts()

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.

◆ clear_read_domains()

void madara::transport::TransportSettings::clear_read_domains ( void  )
inline

Clears the list of read domains.

Definition at line 19 of file TransportSettings.inl.

◆ debug_to_kb()

void madara::transport::TransportSettings::debug_to_kb ( const std::string &  prefix = ".transport")
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.

Parameters
prefixprefix to save debug info into data plane KB

Definition at line 24 of file TransportSettings.inl.

◆ get_read_domains()

void madara::transport::TransportSettings::get_read_domains ( std::vector< std::string > &  domains) const
inline

Retrieves the list of read domains.

Parameters
domainsthe list to fill with all read domains

Definition at line 30 of file TransportSettings.inl.

◆ is_reading_domain()

bool madara::transport::TransportSettings::is_reading_domain ( const std::string  domain) const
inline

Checks if a domain is in the domain read list.

Parameters
domaindomain to check
Returns
true if the domain exists in the read list

Definition at line 41 of file TransportSettings.inl.

◆ load()

void madara::transport::TransportSettings::load ( const std::string &  filename,
const std::string &  prefix = "transport" 
)
virtual

Loads the settings from a binary file.

Parameters
filenamethe file to load from
prefixprefix for all transports settings

Reimplemented in madara::transport::QoSTransportSettings.

Definition at line 150 of file TransportSettings.cpp.

◆ load_text()

void madara::transport::TransportSettings::load_text ( const std::string &  filename,
const std::string &  prefix = "transport" 
)
virtual

Loads the settings from a text file.

Parameters
filenamethe file to load from
prefixprefix for all transports settings

Reimplemented in madara::transport::QoSTransportSettings.

Definition at line 294 of file TransportSettings.cpp.

◆ num_read_domains()

size_t madara::transport::TransportSettings::num_read_domains ( void  ) const
inline

Returns the number of read domains.

Returns
the number of domains in the read list

Definition at line 47 of file TransportSettings.inl.

◆ operator=()

void madara::transport::TransportSettings::operator= ( const TransportSettings settings)

Assignment operator.

Definition at line 88 of file TransportSettings.cpp.

◆ save()

void madara::transport::TransportSettings::save ( const std::string &  filename,
const std::string &  prefix = "transport" 
) const
virtual

Saves the settings from a binary file.

Parameters
filenamethe file to load from
prefixprefix for all transports settings

Reimplemented in madara::transport::QoSTransportSettings.

Definition at line 449 of file TransportSettings.cpp.

◆ save_text()

void madara::transport::TransportSettings::save_text ( const std::string &  filename,
const std::string &  prefix = "transport" 
) const
virtual

Saves the settings from a text file.

Parameters
filenamethe file to load from
prefixprefix for all transports settings

Reimplemented in madara::transport::QoSTransportSettings.

Definition at line 501 of file TransportSettings.cpp.

Friends And Related Function Documentation

◆ Base

friend class Base
friend

Definition at line 83 of file TransportSettings.h.

Member Data Documentation

◆ debug_to_kb_prefix

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.

◆ DEFAULT_DEADLINE

const uint32_t madara::transport::TransportSettings::DEFAULT_DEADLINE = 0
static

Default deadline.

Definition at line 95 of file TransportSettings.h.

◆ DEFAULT_QUEUE_LENGTH

const uint32_t madara::transport::TransportSettings::DEFAULT_QUEUE_LENGTH = 500000
static

Default queue length for event history (must be high for reliable transport.

Definition at line 92 of file TransportSettings.h.

◆ DEFAULT_RELIABILITY

const uint32_t madara::transport::TransportSettings::DEFAULT_RELIABILITY = RELIABLE
static

Default reliability.

Definition at line 101 of file TransportSettings.h.

◆ DEFAULT_TRANSPORT

const uint32_t madara::transport::TransportSettings::DEFAULT_TRANSPORT = NO_TRANSPORT
static

Default transport.

Definition at line 98 of file TransportSettings.h.

◆ delay_launch

bool madara::transport::TransportSettings::delay_launch = false

Delay launching transports until explicit activate call.

Definition at line 273 of file TransportSettings.h.

◆ fragment_map

OriginatorFragmentMap madara::transport::TransportSettings::fragment_map
mutable

Map of fragments received by originator.

Definition at line 282 of file TransportSettings.h.

◆ fragment_queue_length

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.

◆ hosts

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.

◆ id

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.

◆ max_fragment_size

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.

◆ max_send_hertz

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.

◆ never_exit

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.

◆ no_receiving

bool madara::transport::TransportSettings::no_receiving = false

if true, never receive over transport

Definition at line 318 of file TransportSettings.h.

◆ no_sending

bool madara::transport::TransportSettings::no_sending = false

if true, never send over transport

Definition at line 313 of file TransportSettings.h.

◆ on_data_received_logic

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.

◆ processes

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.

◆ queue_length

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.

◆ read_domains_

std::map<std::string, int> madara::transport::TransportSettings::read_domains_
private

Any acceptable read domain is added here.

Definition at line 336 of file TransportSettings.h.

◆ read_thread_hertz

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.

◆ read_threads

uint32_t madara::transport::TransportSettings::read_threads = 1

the number of read threads to start

Definition at line 227 of file TransportSettings.h.

◆ reliability

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.

◆ resend_attempts

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.

◆ send_history

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.

◆ send_reduced_message_header

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.

◆ slack_time

double madara::transport::TransportSettings::slack_time = 0

Time to sleep between sends and rebroadcasts.

Definition at line 285 of file TransportSettings.h.

◆ type

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.

◆ write_domain

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.


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