summaryrefslogtreecommitdiffstats
path: root/ml/Query.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:08 +0000
commit81581f9719bc56f01d5aa08952671d65fda9867a (patch)
tree0f5c6b6138bf169c23c9d24b1fc0a3521385cb18 /ml/Query.h
parentReleasing debian version 1.38.1-1. (diff)
downloadnetdata-81581f9719bc56f01d5aa08952671d65fda9867a.tar.xz
netdata-81581f9719bc56f01d5aa08952671d65fda9867a.zip
Merging upstream version 1.39.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--ml/Query.h57
1 files changed, 0 insertions, 57 deletions
diff --git a/ml/Query.h b/ml/Query.h
deleted file mode 100644
index 42a96e85..00000000
--- a/ml/Query.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef QUERY_H
-#define QUERY_H
-
-#include "ml-private.h"
-
-namespace ml {
-
-class Query {
-public:
- Query(RRDDIM *RD) : RD(RD), Initialized(false) {
- Ops = RD->tiers[0].query_ops;
- }
-
- time_t latestTime() {
- return Ops->latest_time_s(RD->tiers[0].db_metric_handle);
- }
-
- time_t oldestTime() {
- return Ops->oldest_time_s(RD->tiers[0].db_metric_handle);
- }
-
- void init(time_t AfterT, time_t BeforeT) {
- Ops->init(RD->tiers[0].db_metric_handle, &Handle, AfterT, BeforeT, STORAGE_PRIORITY_BEST_EFFORT);
- Initialized = true;
- points_read = 0;
- }
-
- bool isFinished() {
- return Ops->is_finished(&Handle);
- }
-
- ~Query() {
- if (Initialized) {
- Ops->finalize(&Handle);
- global_statistics_ml_query_completed(points_read);
- points_read = 0;
- }
- }
-
- std::pair<time_t, CalculatedNumber> nextMetric() {
- points_read++;
- STORAGE_POINT sp = Ops->next_metric(&Handle);
- return {sp.end_time_s, sp.sum / sp.count };
- }
-
-private:
- RRDDIM *RD;
- bool Initialized;
- size_t points_read;
-
- struct storage_engine_query_ops *Ops;
- struct storage_engine_query_handle Handle;
-};
-
-} // namespace ml
-
-#endif /* QUERY_H */