Module: check_mk
Branch: master
Commit: a0899360aebb67cb65caa5a6df23a960634a08ac
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a0899360aebb67…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Nov 7 08:42:34 2017 +0100
Be more explicit about aggregations.
Change-Id: Ieb763c04e9bd1dc60b0f45193da736ac86666614
---
livestatus/src/BlobColumn.cc | 5 +++++
livestatus/src/BlobColumn.h | 3 +++
livestatus/src/Column.cc | 5 -----
livestatus/src/Column.h | 2 +-
livestatus/src/CustomVarsDictColumn.cc | 5 +++++
livestatus/src/CustomVarsDictColumn.h | 3 +++
livestatus/src/ListColumn.cc | 5 +++++
livestatus/src/ListColumn.h | 3 +++
livestatus/src/NullColumn.cc | 5 +++++
livestatus/src/NullColumn.h | 3 +++
livestatus/src/StringColumn.cc | 5 +++++
livestatus/src/StringColumn.h | 11 +++++++++--
12 files changed, 47 insertions(+), 8 deletions(-)
diff --git a/livestatus/src/BlobColumn.cc b/livestatus/src/BlobColumn.cc
index b9c7814..ec2a6e5 100644
--- a/livestatus/src/BlobColumn.cc
+++ b/livestatus/src/BlobColumn.cc
@@ -41,3 +41,8 @@ std::unique_ptr<Filter> BlobColumn::createFilter(
throw std::runtime_error("filtering on blob column " + name() +
" not supported");
}
+
+std::unique_ptr<Aggregator> BlobColumn::createAggregator(
+ StatsOperation /*operation*/) const {
+ return nullptr;
+}
diff --git a/livestatus/src/BlobColumn.h b/livestatus/src/BlobColumn.h
index 8d8dea6..9643dfa 100644
--- a/livestatus/src/BlobColumn.h
+++ b/livestatus/src/BlobColumn.h
@@ -53,6 +53,9 @@ public:
std::unique_ptr<Filter> createFilter(
RelationalOperator relOp, const std::string &value) const override;
+ std::unique_ptr<Aggregator> createAggregator(
+ StatsOperation operation) const override;
+
virtual std::unique_ptr<std::vector<char>> getValue(Row row) const = 0;
};
diff --git a/livestatus/src/Column.cc b/livestatus/src/Column.cc
index a3675f7..7338e62 100644
--- a/livestatus/src/Column.cc
+++ b/livestatus/src/Column.cc
@@ -55,8 +55,3 @@ const void *Column::shiftPointer(Row row) const {
_extra_extra_offset),
_offset);
}
-
-std::unique_ptr<Aggregator> Column::createAggregator(
- StatsOperation /*unused*/) const {
- return nullptr;
-}
diff --git a/livestatus/src/Column.h b/livestatus/src/Column.h
index 9a2ec06..60a7b18 100644
--- a/livestatus/src/Column.h
+++ b/livestatus/src/Column.h
@@ -69,7 +69,7 @@ public:
RelationalOperator relOp, const std::string &value) const = 0;
virtual std::unique_ptr<Aggregator> createAggregator(
- StatsOperation operation) const;
+ StatsOperation operation) const = 0;
Logger *logger() const { return _logger; }
diff --git a/livestatus/src/CustomVarsDictColumn.cc
b/livestatus/src/CustomVarsDictColumn.cc
index ea8c85a..24b198f 100644
--- a/livestatus/src/CustomVarsDictColumn.cc
+++ b/livestatus/src/CustomVarsDictColumn.cc
@@ -50,6 +50,11 @@ std::unique_ptr<Filter> CustomVarsDictColumn::createFilter(
return std::make_unique<CustomVarsDictFilter>(*this, relOp, value);
}
+std::unique_ptr<Aggregator> CustomVarsDictColumn::createAggregator(
+ StatsOperation /*operation*/) const {
+ return nullptr;
+}
+
std::unordered_map<std::string, std::string> CustomVarsDictColumn::getValue(
Row row) const {
std::unordered_map<std::string, std::string> dict;
diff --git a/livestatus/src/CustomVarsDictColumn.h
b/livestatus/src/CustomVarsDictColumn.h
index ebed4b0..00699aa 100644
--- a/livestatus/src/CustomVarsDictColumn.h
+++ b/livestatus/src/CustomVarsDictColumn.h
@@ -53,6 +53,9 @@ public:
std::unique_ptr<Filter> createFilter(
RelationalOperator relOp, const std::string &value) const override;
+ std::unique_ptr<Aggregator> createAggregator(
+ StatsOperation operation) const override;
+
std::unordered_map<std::string, std::string> getValue(Row row) const;
};
diff --git a/livestatus/src/ListColumn.cc b/livestatus/src/ListColumn.cc
index 832911d..030c909 100644
--- a/livestatus/src/ListColumn.cc
+++ b/livestatus/src/ListColumn.cc
@@ -40,3 +40,8 @@ std::unique_ptr<Filter> ListColumn::createFilter(
RelationalOperator relOp, const std::string &value) const {
return std::make_unique<ListFilter>(*this, relOp, value);
}
+
+std::unique_ptr<Aggregator> ListColumn::createAggregator(
+ StatsOperation /*operation*/) const {
+ return nullptr;
+}
diff --git a/livestatus/src/ListColumn.h b/livestatus/src/ListColumn.h
index 56b5632..6085ca1 100644
--- a/livestatus/src/ListColumn.h
+++ b/livestatus/src/ListColumn.h
@@ -53,6 +53,9 @@ public:
std::unique_ptr<Filter> createFilter(
RelationalOperator relOp, const std::string &value) const override;
+ std::unique_ptr<Aggregator> createAggregator(
+ StatsOperation operation) const override;
+
// TODO(sp) What we actually want here is a stream of strings, not a
// concrete container.
virtual std::vector<std::string> getValue(
diff --git a/livestatus/src/NullColumn.cc b/livestatus/src/NullColumn.cc
index 7201b79..6099e27 100644
--- a/livestatus/src/NullColumn.cc
+++ b/livestatus/src/NullColumn.cc
@@ -38,3 +38,8 @@ std::unique_ptr<Filter> NullColumn::createFilter(
RelationalOperator /*unused*/, const std::string& /*unused*/) const {
throw std::runtime_error("filtering on null column not supported");
}
+
+std::unique_ptr<Aggregator> NullColumn::createAggregator(
+ StatsOperation /*operation*/) const {
+ return nullptr;
+}
diff --git a/livestatus/src/NullColumn.h b/livestatus/src/NullColumn.h
index dc2f816..847ff72 100644
--- a/livestatus/src/NullColumn.h
+++ b/livestatus/src/NullColumn.h
@@ -51,6 +51,9 @@ public:
std::unique_ptr<Filter> createFilter(
RelationalOperator relOp, const std::string &value) const override;
+
+ std::unique_ptr<Aggregator> createAggregator(
+ StatsOperation operation) const override;
};
#endif // NullColumn_h
diff --git a/livestatus/src/StringColumn.cc b/livestatus/src/StringColumn.cc
index 244cf27..5613016 100644
--- a/livestatus/src/StringColumn.cc
+++ b/livestatus/src/StringColumn.cc
@@ -38,3 +38,8 @@ std::unique_ptr<Filter> StringColumn::createFilter(
RelationalOperator relOp, const std::string &value) const {
return std::make_unique<StringFilter>(*this, relOp, value);
}
+
+std::unique_ptr<Aggregator> StringColumn::createAggregator(
+ StatsOperation /*operation*/) const {
+ return nullptr;
+}
diff --git a/livestatus/src/StringColumn.h b/livestatus/src/StringColumn.h
index e269270..e3b1970 100644
--- a/livestatus/src/StringColumn.h
+++ b/livestatus/src/StringColumn.h
@@ -43,12 +43,19 @@ public:
int offset)
: Column(name, description, indirect_offset, extra_offset,
extra_extra_offset, offset) {}
- virtual std::string getValue(Row row) const = 0;
+
+ ColumnType type() const override { return ColumnType::string; }
+
void output(Row row, RowRenderer &r, const contact *auth_user,
std::chrono::seconds timezone_offset) const override;
- ColumnType type() const override { return ColumnType::string; }
+
std::unique_ptr<Filter> createFilter(
RelationalOperator relOp, const std::string &value) const override;
+
+ std::unique_ptr<Aggregator> createAggregator(
+ StatsOperation operation) const override;
+
+ virtual std::string getValue(Row row) const = 0;
};
#endif // StringColumn_h