2019-11-04 19:17:27 +00:00
|
|
|
#include <Access/Quota.h>
|
|
|
|
#include <boost/range/algorithm/equal.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
bool operator ==(const Quota::Limits & lhs, const Quota::Limits & rhs)
|
|
|
|
{
|
|
|
|
return boost::range::equal(lhs.max, rhs.max) && (lhs.duration == rhs.duration)
|
|
|
|
&& (lhs.randomize_interval == rhs.randomize_interval);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Quota::equal(const IAccessEntity & other) const
|
|
|
|
{
|
|
|
|
if (!IAccessEntity::equal(other))
|
|
|
|
return false;
|
|
|
|
const auto & other_quota = typeid_cast<const Quota &>(other);
|
2020-03-07 17:37:38 +00:00
|
|
|
return (all_limits == other_quota.all_limits) && (key_type == other_quota.key_type) && (to_roles == other_quota.to_roles);
|
2019-11-04 19:17:27 +00:00
|
|
|
}
|
|
|
|
|
2022-06-15 18:25:13 +00:00
|
|
|
std::vector<UUID> Quota::findDependencies() const
|
|
|
|
{
|
|
|
|
return to_roles.findDependencies();
|
2019-11-04 19:17:27 +00:00
|
|
|
}
|
|
|
|
|
2022-06-15 18:25:13 +00:00
|
|
|
void Quota::replaceDependencies(const std::unordered_map<UUID, UUID> & old_to_new_ids)
|
|
|
|
{
|
|
|
|
to_roles.replaceDependencies(old_to_new_ids);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|