![]() |
TSDuck v3.45-4798
MPEG Transport Stream Toolkit
|
Client request for an InfluxDB server. More...
#include <tsInfluxRequest.h>


Public Member Functions | |
| InfluxRequest (const InfluxArgs &args) | |
| Constructor. | |
| InfluxRequest (Report *report, const InfluxArgs &args) | |
| Constructor. | |
| InfluxRequest (ReporterBase *delegate, const InfluxArgs &args) | |
| Constructor. | |
| virtual | ~InfluxRequest () override |
| Destructor. | |
| void | abort () |
| Abort a transfer in progress. | |
| void | add (const UString &measurement, const UString &tags, const UString &fields) |
| Add a line in the request being built, with generic value fields. | |
| template<typename INT_T > requires std::integral<INT_T> | |
| void | add (const UString &measurement, const UString &tags, INT_T value) |
| Add a line in the request being built, with one single integer value. | |
| WebRequestArgs & | args () |
| Access the Web request arguments to get or set them. | |
| const WebRequestArgs & | args () const |
| Access the Web request arguments to get them. | |
| bool | close () |
| Close the transfer. | |
| const UString & | currentContent () const |
| Get the current content of the request being built. | |
| bool | downloadBinaryContent (const UString &url, ByteBlockPtr &data, size_t chunk_size=Device::DEFAULT_RECEIVE_BUFFER_SIZE) |
| Download the content of the URL as binary data in one operation. | |
| bool | downloadFile (const UString &url, const fs::path &file_name, size_t chunk_size=Device::DEFAULT_RECEIVE_BUFFER_SIZE) |
| Download the content of the URL in a file in one operation. | |
| bool | downloadTextContent (const UString &url, UString &text, size_t chunk_size=Device::DEFAULT_RECEIVE_BUFFER_SIZE) |
| Download the content of the URL as text in one operation. | |
| bool | isOpen () const |
| Check if a transfer is open. | |
| bool | muteReport (bool mute) |
| Temporarily mute the associated report. | |
| bool | open (const UString &url, size_t buffer_size=Device::DEFAULT_RECEIVE_BUFFER_SIZE) |
| Open an URL and start the transfer. | |
| bool | receive (void *buffer, size_t max_size, size_t &ret_size) |
| Receive data. | |
| virtual Report & | report () const override |
| Access the Report which is associated with this object. | |
| bool | send () |
| Complete the request being built and send it to the InfluxDB server. | |
| Report * | setReport (Report *report) |
| Associate this object with another Report to log errors. | |
| ReporterBase * | setReport (ReporterBase *delegate) |
| Associate this object with another ReporterBase to log errors. | |
| void | start (const Time ×tamp) |
| Start building a request to the InfluxDB server. | |
| const WebRequestStatus & | status () const |
| Access the Web request status. | |
Static Public Member Functions | |
| static int | SilentLevel (bool silent, int default_severity=Severity::Error) |
| Compute a log severity level from a "silent" parameter. | |
| static UString | ToKey (const UString &name) |
| Escape characters in a string to be used as tag key, tag value, or field key. | |
| static UString | ToMeasurement (const UString &name) |
| Escape characters in a string to be used as measurement. | |
| static UString | ToStringValue (const UString &name) |
| Escape characters in a string to be used as field value of type string. | |
Client request for an InfluxDB server.
|
explicit |
Constructor.
| [in] | args | The connection information to the InfluxDB server. A reference is kept in this object. |
| ts::InfluxRequest::InfluxRequest | ( | Report * | report, |
| const InfluxArgs & | args | ||
| ) |
Constructor.
| [in] | report | Where to report errors. The report object must remain valid as long as this object exists or setReport() is used with another Report object. If report is null, log messages are discarded. |
| [in] | args | The connection information to the InfluxDB server. A reference is kept in this object. |
| ts::InfluxRequest::InfluxRequest | ( | ReporterBase * | delegate, |
| const InfluxArgs & | args | ||
| ) |
Constructor.
| [in] | delegate | Use the report of another ReporterBase. If delegate is null, log messages are discarded. |
| [in] | args | The connection information to the InfluxDB server. A reference is kept in this object. |
| void ts::InfluxRequest::start | ( | const Time & | timestamp | ) |
Start building a request to the InfluxDB server.
| [in] | timestamp | Value of the timestamp for that request. |
|
inline |
Add a line in the request being built, with one single integer value.
| [in] | measurement | The name of the measurement. |
| [in] | tags | Comma-separated list of tags "name=value". The names and values must be compatible with the InfluxDB line protocol (use ToKey() if necessary. |
| [in] | value | The measurement value. The field name is implicitly "value". |
| void ts::InfluxRequest::add | ( | const UString & | measurement, |
| const UString & | tags, | ||
| const UString & | fields | ||
| ) |
Add a line in the request being built, with generic value fields.
| [in] | measurement | The name of the measurement. |
| [in] | tags | Comma-separated list of tags "name=value". The names and values must be compatible with the InfluxDB line protocol (use ToKey() if necessary. |
| [in] | fields | The measurement fields. The field names and values must be compatible with the InfluxDB line protocol. |
|
inline |
Get the current content of the request being built.
For debug purpose only.
| bool ts::InfluxRequest::send | ( | ) |
Complete the request being built and send it to the InfluxDB server.
Escape characters in a string to be used as measurement.
| [in] | name | The name to transform. |
Escape characters in a string to be used as tag key, tag value, or field key.
| [in] | name | The name to transform. |
Escape characters in a string to be used as field value of type string.
Do not use for numerical field values. This function adds surrounding quotes.
| [in] | name | The name to transform. |
|
inherited |
Access the Web request arguments to get or set them.
|
inherited |
Access the Web request arguments to get them.
|
inherited |
Access the Web request status.
|
inherited |
|
inherited |
Check if a transfer is open.
|
inherited |
Receive data.
| [out] | buffer | Address of the buffer for the received data. |
| [in] | max_size | Size in bytes of the reception buffer. |
| [out] | ret_size | Size in bytes of the received data. Will never be larger than max_size. When ret_size is zero, this is the end of the transfer. |
|
inherited |
Close the transfer.
|
inherited |
Abort a transfer in progress.
Can be called from another thread.
|
inherited |
Download the content of the URL as binary data in one operation.
The open/read/close session is embedded in this method. The request must be in blocking mode (the default).
| [in] | url | The complete URL to fetch. |
| [out] | data | The content of the URL in a shred pointer. Null in case of error. |
| [in] | chunk_size | Individual download chunk size. |
|
inherited |
Download the content of the URL as text in one operation.
The open/read/close session is embedded in this method.. The downloaded text is converted from UTF-8. End of lines are normalized as LF. The request must be in blocking mode (the default).
| [in] | url | The complete URL to fetch. |
| [out] | text | The content of the URL. |
| [in] | chunk_size | Individual download chunk size. |
|
inherited |
Download the content of the URL in a file in one operation.
The open/read/close session is embedded in this method.. No transformation is applied to the data. The request must be in blocking mode (the default).
| [in] | url | The complete URL to fetch. |
| [in] | file_name | Name of the file to create. |
| [in] | chunk_size | Individual download chunk size. |
|
overridevirtualinherited |
Access the Report which is associated with this object.
Can be called from another thread only if the Report object is thread-safe.
Implements ts::ReporterInterface.
Associate this object with another Report to log errors.
| [in] | report | Where to report errors. The report object must remain valid as long as this object exists or setReport() is used with another Report object. If report is null, log messages are discarded. |
|
inherited |
Associate this object with another ReporterBase to log errors.
| [in] | delegate | Use the report of another ReporterBase. If delegate is null, the previous explicit Report is used.. |
|
inherited |
Temporarily mute the associated report.
| [in] | mute | It true, report() will return a null report (log messages are discarded), until muteReport() is invoked again with mute set to false. |
|
inlinestaticinherited |
Compute a log severity level from a "silent" parameter.
Some subclass methods have a "silent" parameter to avoid reporting errors which may be insignificant, typically when closing a device after an error, in which case the close operation may produce other errors if the previous error left the device in an inconsistent state. While those errors should not be displayed as errors, we still display them at debug level.
| [in] | silent | If true, do not report errors, report debug messages instead. |
| [in] | default_severity | Default severity, in non-silent mode (error by default). |