2020-03-07 17:37:38 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-11-18 18:43:02 +00:00
|
|
|
#include <Access/Common/QuotaDefs.h>
|
2020-03-07 17:37:38 +00:00
|
|
|
#include <chrono>
|
2021-11-18 18:43:02 +00:00
|
|
|
#include <optional>
|
2020-03-07 17:37:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
/// The information about a quota consumption.
|
2020-05-08 12:50:45 +00:00
|
|
|
struct QuotaUsage
|
2020-03-07 17:37:38 +00:00
|
|
|
{
|
|
|
|
struct Interval
|
|
|
|
{
|
2021-11-18 18:07:35 +00:00
|
|
|
QuotaValue used[static_cast<size_t>(QuotaType::MAX)];
|
|
|
|
std::optional<QuotaValue> max[static_cast<size_t>(QuotaType::MAX)];
|
2020-03-07 17:37:38 +00:00
|
|
|
std::chrono::seconds duration = std::chrono::seconds::zero();
|
|
|
|
bool randomize_interval = false;
|
|
|
|
std::chrono::system_clock::time_point end_of_interval;
|
|
|
|
Interval();
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<Interval> intervals;
|
|
|
|
UUID quota_id;
|
|
|
|
String quota_name;
|
|
|
|
String quota_key;
|
2020-05-08 12:50:45 +00:00
|
|
|
QuotaUsage();
|
2020-03-07 17:37:38 +00:00
|
|
|
};
|
|
|
|
}
|