05.03., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit aa6fd6cf authored by Alessio Netti's avatar Alessio Netti

libdcdb: adding group queries in SensorDataStore

- overloaded query() and fuzzyQuery() methods that allow to query a set
of sensor IDs at the same time
- also changed the behavior of fuzzuQuery(): only one query is performed
now, retrieving the most recent value BEFORE the specified timestamp
parent 150e5b1f
......@@ -158,6 +158,18 @@ public:
*/
void query(std::list<SensorDataStoreReading>& result, SensorId& sid, TimeStamp& start, TimeStamp& end, QueryAggregate aggregate=AGGREGATE_NONE);
/**
* @brief This function queries a the values of
* a set of sensors in the given time range.
* The weekstamp being used is in this case that of the sensor ID
* at the front of the input list.
* @param result The list where the results will be stored.
* @param sids The list of SensorIds to query.
* @param start Start of the time series.
* @param end End of the time series.
*/
void query(std::list<SensorDataStoreReading>& result, std::list<SensorId>& sids, TimeStamp& start, TimeStamp& end, QueryAggregate aggregate=AGGREGATE_NONE);
/**
* @brief This function performs a fuzzy query and returns the
* closest sensor reading to the input timestamp.
......@@ -168,6 +180,18 @@ public:
*/
void fuzzyQuery(std::list<SensorDataStoreReading>& result, SensorId& sid, TimeStamp& ts, uint64_t tol_ns=10000000000);
/**
* @brief This function performs a fuzzy query and returns the closest
* sensor reading to the input timestamp, one per queried sensor.
* The weekstamp being used is in this case that of the sensor ID
* at the front of the input list.
* @param result The list where the results will be stored.
* @param sids The list of SensorIds to query.
* @param ts The target timestamp.
* @param tol_ns Tolerance of the fuzzy query in nanoseconds.
*/
void fuzzyQuery(std::list<SensorDataStoreReading>& result, std::list<SensorId>& sids, TimeStamp& ts, uint64_t tol_ns=10000000000);
typedef void (*QueryCbFunc)(SensorDataStoreReading& reading, void* userData);
/**
* @brief This function queries a sensor's values in
......
......@@ -40,6 +40,8 @@
#include "dcdb/sensordatastore.h"
#include "dcdb/connection.h"
#define QUERY_GROUP_LIMIT 1000
namespace DCDB {
static std::string const AggregateString[] = {"", "min", "max", "avg", "sum", "count"};
......@@ -119,7 +121,7 @@ public:
void setDebugLog(bool dl);
/**
* @brief This function querie a sensor's values in
* @brief This function queries a sensor's values in
* the given time range.
* @param result The list where the results will be stored.
* @param sid The SensorId to query.
......@@ -128,7 +130,19 @@ public:
*/
void query(std::list<SensorDataStoreReading>& result, SensorId& sid, TimeStamp& start, TimeStamp& end, QueryAggregate aggregate);
/**
/**
* @brief This function queries a the values of
* a set of sensors in the given time range.
* The weekstamp being used is in this case that
* of the sensor ID at the front of the input list.
* @param result The list where the results will be stored.
* @param sids The list of SensorIds to query.
* @param start Start of the time series.
* @param end End of the time series.
*/
void query(std::list<SensorDataStoreReading>& result, std::list<SensorId>& sids, TimeStamp& start, TimeStamp& end, QueryAggregate aggregate);
/**
* @brief This function performs a fuzzy query and returns the
* closest sensor reading to the input timestamp.
* @param result The list where the results will be stored.
......@@ -136,7 +150,19 @@ public:
* @param ts The target timestamp.
* @param tol_ns Tolerance of the fuzzy query in nanoseconds.
*/
void fuzzyQuery(std::list<SensorDataStoreReading>& result, SensorId& sid, TimeStamp& ts, uint64_t tol_ns=10000000000);
void fuzzyQuery(std::list<SensorDataStoreReading>& result, SensorId& sid, TimeStamp& ts, uint64_t tol_ns=10000000000);
/**
* @brief This function performs a fuzzy query and returns the closest
* sensor reading to the input timestamp, one per queried sensor.
* The weekstamp being used is in this case that of the sensor ID
* at the front of the input list.
* @param result The list where the results will be stored.
* @param sids The list of SensorIds to query.
* @param ts The target timestamp.
* @param tol_ns Tolerance of the fuzzy query in nanoseconds.
*/
void fuzzyQuery(std::list<SensorDataStoreReading>& result, std::list<SensorId>& sids, TimeStamp& ts, uint64_t tol_ns=10000000000);
/**
* @brief This function queries a sensor's values in
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment