vkdb
A time series database engine in C++.
Loading...
Searching...
No Matches
vkdb::TimeSeriesKey Class Reference

Represents a key in vkdb. More...

#include <time_series_key.h>

Public Member Functions

 TimeSeriesKey () noexcept=default
 Construct a new TimeSeriesKey object.
 
 TimeSeriesKey (std::string &&str)
 Construct a new TimeSeriesKey object from the given string.
 
 TimeSeriesKey (Timestamp timestamp, Metric metric, TagTable tags) noexcept
 Construct a new Time Series Key objec from the given timestamp, metric, and tags.
 
 TimeSeriesKey (TimeSeriesKey &&) noexcept=default
 Move-construct a new TimeSeriesKey object.
 
TimeSeriesKeyoperator= (TimeSeriesKey &&) noexcept=default
 Move-assign a new TimeSeriesKey object.
 
 TimeSeriesKey (const TimeSeriesKey &) noexcept=default
 Copy-construct a new TimeSeriesKey object.
 
TimeSeriesKeyoperator= (const TimeSeriesKey &) noexcept=default
 Copy-assign a new TimeSeriesKey object.
 
 ~TimeSeriesKey () noexcept=default
 Destroy the TimeSeriesKey object.
 
bool operator== (const TimeSeriesKey &other) const noexcept
 Equality operator.
 
bool operator!= (const TimeSeriesKey &other) const noexcept
 Inequality operator.
 
bool operator< (const TimeSeriesKey &other) const noexcept
 Less-than operator.
 
bool operator> (const TimeSeriesKey &other) const noexcept
 Greater-than operator.
 
bool operator<= (const TimeSeriesKey &other) const noexcept
 Less-than-or-equal-to operator.
 
bool operator>= (const TimeSeriesKey &other) const noexcept
 Greater-than-or-equal-to operator.
 
Timestamp timestamp () const noexcept
 Get the timestamp.
 
Metric metric () const noexcept
 Get the metric.
 
const TagTable & tags () const noexcept
 Get the tags.
 
std::string str () const noexcept
 Get the string representation of the key.
 

Static Public Attributes

static constexpr auto TIMESTAMP_WIDTH {20}
 Timestamp width.
 
static constexpr auto MAX_METRIC_LENGTH {15}
 Metric width.
 

Detailed Description

Represents a key in vkdb.

Definition at line 86 of file time_series_key.h.

Constructor & Destructor Documentation

◆ TimeSeriesKey() [1/2]

vkdb::TimeSeriesKey::TimeSeriesKey ( std::string && str)
explicit

Construct a new TimeSeriesKey object from the given string.

Parameters
strThe string representation of the key.
Exceptions
std::exceptionIf the string is invalid.

Definition at line 4 of file time_series_key.cpp.

◆ TimeSeriesKey() [2/2]

vkdb::TimeSeriesKey::TimeSeriesKey ( Timestamp timestamp,
Metric metric,
TagTable tags )
explicitnoexcept

Construct a new Time Series Key objec from the given timestamp, metric, and tags.

Parameters
timestampTimestamp.
metricMetric.
tagsTags.

Definition at line 27 of file time_series_key.cpp.

Member Function Documentation

◆ metric()

Metric vkdb::TimeSeriesKey::metric ( ) const
nodiscardnoexcept

Get the metric.

Returns
Metric The metric.

Definition at line 93 of file time_series_key.cpp.

◆ operator!=()

bool vkdb::TimeSeriesKey::operator!= ( const TimeSeriesKey & other) const
nodiscardnoexcept

Inequality operator.

Parameters
otherThe other key.
Returns
true If the keys are not equal.
false If the keys are equal.

Definition at line 51 of file time_series_key.cpp.

◆ operator<()

bool vkdb::TimeSeriesKey::operator< ( const TimeSeriesKey & other) const
nodiscardnoexcept

Less-than operator.

First, the keys are checked to see if they are the minimum or maximum keys. If they aren't, the comparison is done based on the key's properties. The comparison is done in the following order: The comparison is done in the following order:

  1. Timestamp.
  2. Metric.
  3. Tags.
Parameters
otherThe other key.
Returns
true If this key is less than the other key.
false If this key is not less than the other key.

Definition at line 55 of file time_series_key.cpp.

◆ operator<=()

bool vkdb::TimeSeriesKey::operator<= ( const TimeSeriesKey & other) const
nodiscardnoexcept

Less-than-or-equal-to operator.

Parameters
otherThe other key.
Returns
true If this key is less than or equal to the other key.
false If this key is not less than or equal to the other key.

Definition at line 81 of file time_series_key.cpp.

◆ operator==()

bool vkdb::TimeSeriesKey::operator== ( const TimeSeriesKey & other) const
nodiscardnoexcept

Equality operator.

Parameters
otherThe other key.
Returns
true If the keys are equal.
false If the keys are not equal.

Definition at line 47 of file time_series_key.cpp.

◆ operator>()

bool vkdb::TimeSeriesKey::operator> ( const TimeSeriesKey & other) const
nodiscardnoexcept

Greater-than operator.

Parameters
otherThe other key.
Returns
true If this key is greater than the other key.
false If this key is not greater than the other key.

Definition at line 77 of file time_series_key.cpp.

◆ operator>=()

bool vkdb::TimeSeriesKey::operator>= ( const TimeSeriesKey & other) const
nodiscardnoexcept

Greater-than-or-equal-to operator.

Parameters
otherThe other key.
Returns
true If this key is greater than or equal to the other key.
false If this key is not greater than or equal to the other key.

Definition at line 85 of file time_series_key.cpp.

◆ str()

std::string vkdb::TimeSeriesKey::str ( ) const
nodiscardnoexcept

Get the string representation of the key.

Returns
std::string The string representation of the key.

Definition at line 101 of file time_series_key.cpp.

◆ tags()

const TagTable & vkdb::TimeSeriesKey::tags ( ) const
nodiscardnoexcept

Get the tags.

Returns
const TagTable& The tags.

Definition at line 97 of file time_series_key.cpp.

◆ timestamp()

Timestamp vkdb::TimeSeriesKey::timestamp ( ) const
nodiscardnoexcept

Get the timestamp.

Returns
Timestamp The timestamp.

Definition at line 89 of file time_series_key.cpp.

Member Data Documentation

◆ MAX_METRIC_LENGTH

auto vkdb::TimeSeriesKey::MAX_METRIC_LENGTH {15}
staticconstexpr

Metric width.

Definition at line 98 of file time_series_key.h.

◆ TIMESTAMP_WIDTH

auto vkdb::TimeSeriesKey::TIMESTAMP_WIDTH {20}
staticconstexpr

Timestamp width.

Definition at line 92 of file time_series_key.h.


The documentation for this class was generated from the following files: