1#ifndef STORAGE_TIME_SERIES_KEY_H
2#define STORAGE_TIME_SERIES_KEY_H
4#include <vkdb/concepts.h>
18using Timestamp = uint64_t;
24using Metric = std::string;
30using TagKey = std::string;
36using TagValue = std::string;
42using Tag = std::pair<TagKey, TagValue>;
48using TagTable = std::map<TagKey, TagValue>;
55template <ArithmeticNoCVRefQuals TValue>
167 [[nodiscard]]
bool operator==(const
TimeSeriesKey& other) const noexcept;
177 [[nodiscard]]
bool operator!=(const
TimeSeriesKey& other) const noexcept;
194 [[nodiscard]]
bool operator<(const
TimeSeriesKey& other) const noexcept;
204 [[nodiscard]]
bool operator>(const
TimeSeriesKey& other) const noexcept;
214 [[nodiscard]]
bool operator<=(const
TimeSeriesKey& other) const noexcept;
224 [[nodiscard]]
bool operator>=(const
TimeSeriesKey& other) const noexcept;
231 [[nodiscard]] Timestamp
timestamp() const noexcept;
238 [[nodiscard]] Metric
metric() const noexcept;
245 [[nodiscard]] const TagTable&
tags() const noexcept;
252 [[nodiscard]]
std::
string str() const noexcept;
259 Timestamp timestamp_;
321 "MIN_TIME_SERIES_KEY",
322 {{
"MIN_TIME_SERIES_KEY",
"MIN_TIME_SERIES_KEY"}}
330 std::numeric_limits<vkdb::Timestamp>::max(),
331 "MAX_TIME_SERIES_KEY",
332 {{
"MAX_TIME_SERIES_KEY",
"MAX_TIME_SERIES_KEY"}}
339const vkdb::Metric MIN_METRIC{std::string()};
345const vkdb::Metric MAX_METRIC{
356struct hash<vkdb::TimeSeriesKey> {
358 return hash<string>{}(key.
str());
368static const size_t MIN_TIME_SERIES_KEY_HASH{
369 std::hash<vkdb::TimeSeriesKey>{}(MIN_TIME_SERIES_KEY)
376static const size_t MAX_TIME_SERIES_KEY_HASH{
377 std::hash<vkdb::TimeSeriesKey>{}(MAX_TIME_SERIES_KEY)
Represents a key in vkdb.
static constexpr auto TIMESTAMP_WIDTH
Timestamp width.
const TagTable & tags() const noexcept
Get the tags.
TimeSeriesKey() noexcept=default
Construct a new TimeSeriesKey object.
Metric metric() const noexcept
Get the metric.
std::string str() const noexcept
Get the string representation of the key.
static constexpr auto MAX_METRIC_LENGTH
Metric width.
Timestamp timestamp() const noexcept
Get the timestamp.
Concept for arithmetic types that have no cv- or ref-qualifiers.
Represents a datapoint in vkdb.
Timestamp timestamp
Timestamp.