libadc-cxx 1.0.0
Structured logging for scientific computing
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
adc::curl_plugin Class Reference

Curl utility publisher_api implementation. This plugin generates a scratch file (in-memory) and asynchronously sends it to the configured web service by invoking the 'curl' utility. Multiple independent instances of this plugin may be used simultaneously. More...

Inheritance diagram for adc::curl_plugin:
Inheritance graph
[legend]
Collaboration diagram for adc::curl_plugin:
Collaboration graph
[legend]

Public Member Functions

 curl_plugin ()
 
int publish (std::shared_ptr< builder_api > b)
 Publish the content of the builder.
 
int config (const std::map< std::string, std::string > &m)
 Configure the plugin with the options given.
 
int config (const std::map< std::string, std::string > &m, string_view env_prefix)
 Configure the plugin with the options given and the corresponding environment variables.
 
const std::map< const std::string, const std::string > & get_option_defaults ()
 Look up the settable options and their defaults.
 
int initialize ()
 Ready the plugin to publish following the configuration options set or defaulted.
 
void finalize ()
 Stop publishing and release any resources held for managing publication.
 
void pause ()
 Pause publishing until a call to resume. Duplicate calls are allowed.
 
void resume ()
 Resume publishing Duplicate calls are allowed.
 
string_view name () const
 
string_view version () const
 
 ~curl_plugin ()
 

Static Public Attributes

static const char * adc_curl_plugin_directory_default = "/dev/shm/adc"
 default scratch directory for curl utility messages. This directory must be globally writable and should be fast. Overridden with env("ADC_CURL_PLUGIN_DIRECTORY").
 
static const char * adc_curl_plugin_prog_default = "/usr/bin/curl"
 default full path to curl utility This program should be world accessible. Overridden with env("ADC_CURL_PLUGIN_PROG").
 
static const char * adc_curl_plugin_port_default = "443"
 default ADC server https port. The server should be highly available. Overridden with env("ADC_CURL_PLUGIN_PORT").
 
static const char * adc_curl_plugin_url_default = "https://localhost"
 ADC data ingest server host. The server should be highly available; the default value of https://localhost must be overridden by an environment variable unless the test environment includes a test server. Overridden with env("ADC_CURL_PLUGIN_URL").
 
static const char * adc_curl_plugin_debug_default = "0"
 ADC curl plugin enable debug messages; (default "0": none) "2" provides message send debugging "1" provides lighter debugging Overridden with env("ADC_CURL_PLUGIN_DEBUG").
 

Detailed Description

Curl utility publisher_api implementation. This plugin generates a scratch file (in-memory) and asynchronously sends it to the configured web service by invoking the 'curl' utility. Multiple independent instances of this plugin may be used simultaneously.

Definition at line 21 of file curl.ipp.

Constructor & Destructor Documentation

◆ curl_plugin()

adc::curl_plugin::curl_plugin ( )
inline

Definition at line 166 of file curl.ipp.

◆ ~curl_plugin()

adc::curl_plugin::~curl_plugin ( )
inline

Definition at line 282 of file curl.ipp.

Member Function Documentation

◆ publish()

int adc::curl_plugin::publish ( std::shared_ptr< builder_api b)
inlinevirtual

Publish the content of the builder.

Parameters
bconverted to a single json object and published

Implements adc::publisher_api.

Definition at line 170 of file curl.ipp.

◆ config() [1/2]

int adc::curl_plugin::config ( const std::map< std::string, std::string > &  m)
inlinevirtual

Configure the plugin with the options given.

Parameters
ma map with keys documented in the plugin-specific header.

For plugin QQQ, Environment variables ADC_QQQ_PLUGIN_* will override the source code default for any key not defined in m. Here QQQ is the uppercase version of the plugin name.

Implements adc::publisher_api.

Definition at line 207 of file curl.ipp.

◆ config() [2/2]

int adc::curl_plugin::config ( const std::map< std::string, std::string > &  m,
string_view  env_prefix 
)
inlinevirtual

Configure the plugin with the options given and the corresponding environment variables.

Parameters
ma map with keys documented in the plugin-specific header.
env_prefixis prepended to the expected keys for the plugin and values found with getenv that match are used, overriding elements of m. Typically, env_prefix will be PPP_ADC_QQQ_PLUGIN_ if application PPP wants to override the defaults of plugin QQQ. Here QQQ is the uppercase version of the plugin name.

Implements adc::publisher_api.

Definition at line 213 of file curl.ipp.

◆ get_option_defaults()

const std::map< const std::string, const std::string > & adc::curl_plugin::get_option_defaults ( )
inlinevirtual

Look up the settable options and their defaults.

Some plugins without options will return an empty map.

Implements adc::publisher_api.

Definition at line 222 of file curl.ipp.

◆ initialize()

int adc::curl_plugin::initialize ( )
inlinevirtual

Ready the plugin to publish following the configuration options set or defaulted.

Implements adc::publisher_api.

Definition at line 226 of file curl.ipp.

◆ finalize()

void adc::curl_plugin::finalize ( )
inlinevirtual

Stop publishing and release any resources held for managing publication.

Implements adc::publisher_api.

Definition at line 254 of file curl.ipp.

◆ pause()

void adc::curl_plugin::pause ( )
inlinevirtual

Pause publishing until a call to resume. Duplicate calls are allowed.

Implements adc::publisher_api.

Definition at line 266 of file curl.ipp.

◆ resume()

void adc::curl_plugin::resume ( )
inlinevirtual

Resume publishing Duplicate calls are allowed.

Implements adc::publisher_api.

Definition at line 270 of file curl.ipp.

◆ name()

string_view adc::curl_plugin::name ( ) const
inlinevirtual
Returns
the name of the plugin

Implements adc::publisher_api.

Definition at line 274 of file curl.ipp.

◆ version()

string_view adc::curl_plugin::version ( ) const
inlinevirtual
Returns
the version of the plugin (should follow semantic versioning practices)

Implements adc::publisher_api.

Definition at line 278 of file curl.ipp.

Member Data Documentation

◆ adc_curl_plugin_directory_default

const char* adc::curl_plugin::adc_curl_plugin_directory_default = "/dev/shm/adc"
inlinestatic

default scratch directory for curl utility messages. This directory must be globally writable and should be fast. Overridden with env("ADC_CURL_PLUGIN_DIRECTORY").

Definition at line 37 of file curl.ipp.

◆ adc_curl_plugin_prog_default

const char* adc::curl_plugin::adc_curl_plugin_prog_default = "/usr/bin/curl"
inlinestatic

default full path to curl utility This program should be world accessible. Overridden with env("ADC_CURL_PLUGIN_PROG").

Definition at line 42 of file curl.ipp.

◆ adc_curl_plugin_port_default

const char* adc::curl_plugin::adc_curl_plugin_port_default = "443"
inlinestatic

default ADC server https port. The server should be highly available. Overridden with env("ADC_CURL_PLUGIN_PORT").

Definition at line 47 of file curl.ipp.

◆ adc_curl_plugin_url_default

const char* adc::curl_plugin::adc_curl_plugin_url_default = "https://localhost"
inlinestatic

ADC data ingest server host. The server should be highly available; the default value of https://localhost must be overridden by an environment variable unless the test environment includes a test server. Overridden with env("ADC_CURL_PLUGIN_URL").

Definition at line 54 of file curl.ipp.

◆ adc_curl_plugin_debug_default

const char* adc::curl_plugin::adc_curl_plugin_debug_default = "0"
inlinestatic

ADC curl plugin enable debug messages; (default "0": none) "2" provides message send debugging "1" provides lighter debugging Overridden with env("ADC_CURL_PLUGIN_DEBUG").

Definition at line 60 of file curl.ipp.


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