nidas v1.2.3
Classes | Functions
data_influxdb.cc File Reference
#include <ctime>
#include <nidas/core/FileSet.h>
#include <nidas/core/Socket.h>
#include <nidas/dynld/RawSampleInputStream.h>
#include <nidas/core/Project.h>
#include <nidas/core/XMLParser.h>
#include <nidas/core/SamplePipeline.h>
#include <nidas/core/DSMConfig.h>
#include <nidas/core/DSMSensor.h>
#include <nidas/core/Variable.h>
#include <nidas/core/NidasApp.h>
#include <nidas/util/EOFException.h>
#include <nidas/util/Process.h>
#include <nidas/util/Logger.h>
#include <nidas/util/auto_ptr.h>
#include <nidas/util/util.h>
#include <set>
#include <map>
#include <iostream>
#include <iomanip>
#include <sys/stat.h>
#include <unistd.h>
#include <stdexcept>
#include <fstream>
#include <string>
#include <sstream>
#include <stdio.h>
#include <curl/curl.h>
#include <curl/easy.h>
#include <future>
#include <mutex>
#include <json/json.h>

Classes

class  CharBuffer
 Simple char buffer class to provide memory into which C strings can be written. More...
 
class  InfluxDB
 Methods and memory for creating an Influx database, accumulating measurements, and posting them to the database. More...
 
class  SampleToDatabase
 
class  SampleDispatcher
 
class  DataInfluxdb
 
class  AutoProject
 

Functions

std::string string_to_lower (const std::string &upper)
 
CURLcode dataToInfluxDB (CURL *curl, const std::string &url, CharBuffer *data, unsigned int nmeasurements)
 Post the given data buffer to the database, then clear it.
 
size_t writeInfluxResult (void *buffer, size_t size, size_t nmemb, void *userp)
 
void backslash (std::string &tagvalue)
 Escape comma, space, and equal characters in the given string with backslash, to conform to influxdb line protocol for tag values.
 
std::string id_to_string (unsigned int id)
 
int main (int argc, char **argv)
 

Function Documentation

◆ backslash()

void backslash ( std::string & tagvalue)

Escape comma, space, and equal characters in the given string with backslash, to conform to influxdb line protocol for tag values.

References nidas::core::getSample().

Referenced by SampleToDatabase::SampleToDatabase().

◆ dataToInfluxDB()

CURLcode dataToInfluxDB ( CURL * curl,
const std::string & url,
CharBuffer * data,
unsigned int nmeasurements )

Post the given data buffer to the database, then clear it.

This is a function and not a method of InfluxDB, so that it only uses the variables passed into it and no locking is needed to ensure exclusive access to the object. The CURL pointer is only ever used here, so as long as only double-buffering is used, only one thread should ever call into the curl library at a time.

References CharBuffer::clear(), DLOG, ELOG, CharBuffer::get(), and nidas::core::getSample().

Referenced by InfluxDB::sendData().

◆ id_to_string()

std::string id_to_string ( unsigned int id)

◆ main()

int main ( int argc,
char ** argv )

◆ string_to_lower()

std::string string_to_lower ( const std::string & upper)

◆ writeInfluxResult()

size_t writeInfluxResult ( void * buffer,
size_t size,
size_t nmemb,
void * userp )

References buffer, and nidas::core::getSample().

Referenced by InfluxDB::open().