|
vkdb
A time series database engine in C++.
|
Query builder for querying a Table. More...
#include <builder.h>
Public Types | |
| using | keytype = TimeSeriesKey |
| using | mapped_type = std::optional<TValue> |
| using | valuetype = std::pair<const keytype, mapped_type> |
| using | size_type = uint64_t |
| using | result_type = std::vector<valuetype> |
Public Member Functions | |
| QueryBuilder ()=delete | |
| Deleted default constructor. | |
| QueryBuilder (LSMTree< TValue > &lsm_tree, const TagColumns &tag_columns) noexcept | |
| Construct a new QueryBuilder object. | |
| QueryBuilder (QueryBuilder &&) noexcept=default | |
| Move-construct a QueryBuilder object. | |
| QueryBuilder & | operator= (QueryBuilder &&) noexcept=default |
| Move-assign a QueryBuilder object. | |
| QueryBuilder (const QueryBuilder &) noexcept=default | |
| Copy-construct a QueryBuilder object. | |
| QueryBuilder & | operator= (const QueryBuilder &) noexcept=default |
| Copy-assign a QueryBuilder object. | |
| ~QueryBuilder () noexcept=default | |
| Destroy the Query Builder object. | |
| QueryBuilder & | point (const keytype &key) |
| Configure builder for point query. | |
| QueryBuilder & | range (const keytype &start, const keytype &end) |
| Configure builder for range query. | |
| QueryBuilder & | filterByTag (const TagKey &key, const TagValue &value) |
| Filter the TimeSeriesKeys by a tag. | |
| template<typename... Tags> requires (AllConvertibleToNoCVRefQuals<Tag, Tags> && ...) | |
| QueryBuilder & | filterByAnyTags (const Tags &... tags) |
| Filter the TimeSeriesKeys by multiple tags. | |
| template<typename... Tags> requires (AllConvertibleToNoCVRefQuals<Tag, Tags> && ...) | |
| QueryBuilder & | filterByAllTags (const Tags &... tags) |
| Filter the TimeSeriesKeys by multiple tags. | |
| QueryBuilder & | filterByMetric (const Metric &metric) |
| Filter the TimeSeriesKeys by a metric. | |
| template<typename... Metrics> requires (AllConvertibleToNoCVRefQuals<Metric, Metrics> && ...) | |
| QueryBuilder & | filterByAnyMetrics (const Metrics &... metrics) |
| Filter the TimeSeriesKeys by multiple metrics. | |
| QueryBuilder & | filterByTimestamp (const Timestamp ×tamp) |
| Filter the TimeSeriesKeys by a timestamp. | |
| template<typename... Timestamps> requires (AllConvertibleToNoCVRefQuals<Timestamp, Timestamps> && ...) | |
| QueryBuilder & | filterByAnyTimestamps (const Timestamps &... timestamps) |
| Filter the TimeSeriesKeys by multiple timestamps. | |
| QueryBuilder & | put (const keytype &key, const TValue &value) |
| Put a key-value pair into the LSMTree. | |
| QueryBuilder & | remove (const keytype &key) |
| Remove a key from the LSMTree. | |
| size_type | count () |
| Count the number of entries in the range. | |
| TValue | sum () |
| Sum the values in the range. | |
| double | avg () |
| Calculate the average of the values in the range. | |
| TValue | min () |
| Calculate the minimum value in the range. | |
| TValue | max () |
| Calculate the maximum value in the range. | |
| result_type | execute () |
| Execute the query. | |
Query builder for querying a Table.
| TValue | Type of the value of the TimeSeriesKey. |
| using vkdb::QueryBuilder< TValue >::keytype = TimeSeriesKey |
| using vkdb::QueryBuilder< TValue >::mapped_type = std::optional<TValue> |
| using vkdb::QueryBuilder< TValue >::result_type = std::vector<valuetype> |
| using vkdb::QueryBuilder< TValue >::size_type = uint64_t |
| using vkdb::QueryBuilder< TValue >::valuetype = std::pair<const keytype, mapped_type> |
|
inlineexplicitnoexcept |
Construct a new QueryBuilder object.
Query type is set to NONE and filters are initialised with a filter that always returns true.
|
inlinenodiscard |
Calculate the average of the values in the range.
Sets up the QueryBuilder for aggregation and returns the average of the values in the range.
| std::runtime_error | If the aggregate setup fails or the range is empty. |
|
inlinenodiscard |
Count the number of entries in the range.
Sets up the QueryBuilder for aggregation and returns the number of entries in the range.
| std::runtime_error | If the aggregate setup fails. |
|
inline |
Execute the query.
Executes the query based on the query type and query parameters.
| std::runtime_error | If the query type is unset and there are no filters, or if the query type is invalid, or if the execution fails. |
|
inlinenodiscard |
Filter the TimeSeriesKeys by multiple tags.
Adds a filter that checks if the TimeSeriesKey has all of the specified tags.
| Tags | Variadic template parameter for tags to filter by. |
| tags | Tags to filter by. |
| std::runtime_error | If a tag key is not in the tag columns. |
|
inlinenodiscard |
Filter the TimeSeriesKeys by multiple metrics.
Adds a filter that checks if the TimeSeriesKey has any of the specified metrics.
| Metrics | Variadic template parameter for metrics to filter by. |
| metrics | Metrics to filter by. |
| std::runtime_error | If adding the filter fails. |
|
inlinenodiscard |
Filter the TimeSeriesKeys by multiple tags.
Adds a filter that checks if the TimeSeriesKey has any of the specified tags.
| Tags | Variadic template parameter for tags to filter by. |
| tags | Tags to filter by. |
| std::runtime_error | If a tag key is not in the tag columns. |
|
inlinenodiscard |
Filter the TimeSeriesKeys by multiple timestamps.
Adds a filter that checks if the TimeSeriesKey has any of the specified timestamps.
| Timestamps | Variadic template parameter for timestamps to filter by. |
| timestamps | Timestamps to filter by. |
| std::runtime_error | If adding the filter fails. |
|
inlinenodiscard |
Filter the TimeSeriesKeys by a metric.
Adds a filter that checks if the TimeSeriesKey has the specified metric.
| metric | Metric to filter by. |
| std::runtime_error | If adding the filter fails. |
|
inlinenodiscard |
Filter the TimeSeriesKeys by a tag.
Adds a filter that checks if the TimeSeriesKey has the specified tag.
| key | Tag key to filter by. |
| value | Tag value to filter by. |
| std::runtime_error | If the tag key is not in the tag columns. |
|
inlinenodiscard |
Filter the TimeSeriesKeys by a timestamp.
Adds a filter that checks if the TimeSeriesKey has the specified timestamp.
| timestamp | Timestamp to filter by. |
| std::runtime_error | If adding the filter fails. |
|
inlinenodiscard |
Calculate the maximum value in the range.
Sets up the QueryBuilder for aggregation and returns the maximum value in the range.
| std::runtime_error | If the aggregate setup fails or the range is empty. |
|
inlinenodiscard |
Calculate the minimum value in the range.
Sets up the QueryBuilder for aggregation and returns the minimum value in the range.
| std::runtime_error | If the aggregate setup fails or the range is empty. |
|
inlinenodiscard |
Configure builder for point query.
Query type is set to POINT and query parameters are set to the TimeSeriesKey to query.
| key | TimeSeriesKey to query. |
| std::runtime_error | If a tag in the key is not in the tag columns. |
|
inlinenodiscard |
Put a key-value pair into the LSMTree.
| key | Key to put. |
| value | Value to put. |
| std::runtime_error | If any of the key's tags are not in the tag columns. |
|
inlinenodiscard |
Configure builder for range query.
Query type is set to RANGE and query parameters are set to the start and end TimeSeriesKeys of the range.
| start | Start TimeSeriesKey of the range. |
| end | End TimeSeriesKey of the range. |
| std::runtime_error | If a tag in the start or end key is not in the tag columns. |
|
inlinenodiscard |
Remove a key from the LSMTree.
| key | Key to remove. |
| std::runtime_error | If any of the key's tags are not in the tag columns. |
|
inlinenodiscard |
Sum the values in the range.
Sets up the QueryBuilder for aggregation and returns the sum of the values in the range.
| std::runtime_error | If the aggregate setup fails or the range is empty. |