2020-03-07 17:37:38 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Access/Quota.h>
|
|
|
|
#include <chrono>
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
using ResourceType = Quota::ResourceType;
|
|
|
|
using ResourceAmount = Quota::ResourceAmount;
|
2020-05-02 16:05:01 +00:00
|
|
|
static constexpr auto MAX_RESOURCE_TYPE = Quota::MAX_RESOURCE_TYPE;
|
2020-03-07 17:37:38 +00:00
|
|
|
|
|
|
|
struct Interval
|
|
|
|
{
|
|
|
|
ResourceAmount used[MAX_RESOURCE_TYPE];
|
2020-05-08 12:50:45 +00:00
|
|
|
std::optional<ResourceAmount> max[MAX_RESOURCE_TYPE];
|
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
|
|
|
};
|
|
|
|
}
|