1 #ifndef _SENDING_PROCESS_H 2 #define _SENDING_PROCESS_H 16 #include <north_plugin.h> 18 #include <filter_plugin.h> 19 #include <north_filter_pipeline.h> 20 #include <asset_tracking.h> 34 int getStreamId()
const {
return m_stream_id; };
35 bool isRunning()
const {
if (m_dryRun)
return false;
return m_running; };
36 void stopRunning() { m_running =
false; };
37 void setLastFetchId(
unsigned long id) { m_last_fetch_id = id; };
38 unsigned long getLastFetchId()
const {
return m_last_fetch_id; };
39 void setLastSentId(
unsigned long id) { m_last_sent_id = id; };
40 unsigned long getLastSentId()
const {
return m_last_sent_id; };
42 unsigned long getSentReadings()
const {
return m_tot_sent; };
43 bool updateSentReadings(
unsigned long num) {
47 void resetSentReadings() { m_tot_sent = 0; };
52 unsigned int getDuration()
const {
return m_duration; };
53 unsigned int getSleepTime()
const {
return m_sleep; };
54 bool getUpdateDb()
const {
return m_update_db; };
55 bool setUpdateDb(
bool val) {
59 unsigned long getReadBlockSize()
const {
return m_block_size; };
60 const std::string& getDataSourceType()
const {
return m_data_source_t; };
61 const std::string& getPluginName()
const {
return m_plugin_name; };
66 unsigned long getMemoryBufferSize()
const {
return m_memory_buffer_size; };
68 std::string parent_name,
69 std::string current_name,
70 std::string current_description);
74 static void setLoadBufferData(
unsigned long index,
76 static std::vector<ReadingSet *>*
77 getDataBuffers() {
return m_buffer_ptr; };
84 std::string retrieveTableInformationName(
const char* dataSource);
85 void updateStreamLastSentId(
long lastSentId);
86 void setDuration(
unsigned int val) { m_duration = val; };
87 void setSleepTime(
unsigned long val) { m_sleep = val; };
88 void setReadBlockSize(
unsigned long size) { m_block_size = size; };
89 bool loadPlugin(
const std::string& pluginName);
91 const std::string& pluginName);
92 bool loadFilters(
const std::string& pluginName);
93 void updateStatistics(std::string& stat_key,
94 const std::string& stat_description);
101 std::vector<ReadingSet *> m_buffer;
102 std::thread* m_thread_load;
103 std::thread* m_thread_send;
105 std::vector<unsigned long> m_last_read_id;
111 unsigned long m_last_sent_id;
112 unsigned long m_last_fetch_id;
113 unsigned long m_tot_sent;
114 unsigned int m_duration;
115 unsigned long m_sleep;
116 unsigned long m_block_size;
118 std::string m_plugin_name;
120 std::string m_data_source_t;
121 unsigned long m_load_buffer_index;
122 unsigned long m_memory_buffer_size = 1;
125 static std::vector<ReadingSet *>*
Fledge Logger class used to log to syslog.
Definition: logger.h:26
unsigned long getLoadBufferIndex() const
Get the current buffer load index.
Definition: sending.cpp:1027
DefaultConfigCategory.
Definition: config_category.h:236
Definition: config_category.h:56
bool getLastSentReadingId()
Get last_object id sent for current stream_id Access foglam.streams table.
Definition: sending.cpp:628
bool createStream(int)
Creates a new stream, it adds a new row into the streams table allocating specific stream id...
Definition: sending.cpp:717
Fledge process base class.
Definition: process.h:21
static void passToOnwardFilter(OUTPUT_HANDLE *outHandle, READINGSET *readings)
Pass the current readings set to the next filter in the pipeline.
Definition: sending.cpp:1003
void updateDatabaseCounters()
Update database tables statistics and streams setting last_object id in streams.
Definition: sending.cpp:512
void createConfigCategories(DefaultConfigCategory configCategory, std::string parent_name, std::string current_name, std::string current_description)
Creates config categories and sub categories recursively, along with their parent-child relations...
Definition: sending.cpp:743
Reading set class.
Definition: reading_set.h:26
const unsigned long * getLoadBufferIndexPtr() const
Get the current buffer load index pointer.
Definition: sending.cpp:1041
The NorthFilterPipeline class is derived from FilterPipeline class and is used to represent a pipelin...
Definition: north_filter_pipeline.h:21
Class that represents a north plugin.
Definition: north_plugin.h:33
void setLoadBufferIndex(unsigned long loadBufferIdx)
Set the current buffer load index.
Definition: sending.cpp:1017
int createNewStream()
Creates a new stream, it adds a new row into the streams table allocating a new stream id...
Definition: sending.cpp:671
The AssetTracker class provides the asset tracking functionality.
Definition: asset_tracking.h:239
SendingProcess(int argc, char **argv)
Definition: sending.cpp:145
~SendingProcess()
SendingProcess class methods.
Definition: sending.cpp:137
static void useFilteredData(OUTPUT_HANDLE *outHandle, READINGSET *readings)
Use the current input readings (they have been filtered by all filters)
Definition: sending.cpp:984