#ifndef CEPH_RGW_KEYSTONE_H
#define CEPH_RGW_KEYSTONE_H
-#include <type_traits>
+#include <atomic>
#include <string_view>
+#include <type_traits>
+#include <utility>
#include <boost/optional.hpp>
#include "common/ceph_mutex.h"
#include "global/global_init.h"
-#include <atomic>
bool rgw_is_pki_token(const std::string& token);
void rgw_get_token_id(const std::string& token, std::string& token_id);
bool has_role(const std::string& r) const;
bool expired() const {
const uint64_t now = ceph_clock_now().sec();
- return now >= static_cast<uint64_t>(get_expires());
+ return std::cmp_greater_equal(now, get_expires());
}
int parse(const DoutPrefixProvider *dpp, CephContext* cct,
const std::string& token_str,
const uint64_t cur_size = stats.size_rounded;
const uint64_t new_size = rgw_rounded_objsize(size);
- if (cur_size + new_size > static_cast<uint64_t>(qinfo.max_size)) {
+ if (std::cmp_greater(cur_size + new_size, qinfo.max_size)) {
ldpp_dout(dpp, 10) << "quota exceeded: stats.size_rounded=" << stats.size_rounded
<< " size=" << new_size << " "
<< entity << "_quota.max_size=" << qinfo.max_size << dendl;
return false;
}
- if (stats.num_objects + num_objs > static_cast<uint64_t>(qinfo.max_objects)) {
+ if (std::cmp_greater(stats.num_objects + num_objs, qinfo.max_objects)) {
ldpp_dout(dpp, 10) << "quota exceeded: stats.num_objects=" << stats.num_objects
<< " " << entity << "_quota.max_objects=" << qinfo.max_objects
<< dendl;
const uint64_t cur_size = stats.size;
- if (cur_size + size > static_cast<uint64_t>(qinfo.max_size)) {
+ if (std::cmp_greater(cur_size + size, qinfo.max_size)) {
ldpp_dout(dpp, 10) << "quota exceeded: stats.size=" << stats.size
<< " size=" << size << " "
<< entity << "_quota.max_size=" << qinfo.max_size << dendl;
return false;
}
- if (stats.num_objects + num_objs > static_cast<uint64_t>(qinfo.max_objects)) {
+ if (std::cmp_greater(stats.num_objects + num_objs, qinfo.max_objects)) {
ldpp_dout(dpp, 10) << "quota exceeded: stats.num_objects=" << stats.num_objects
<< " " << entity << "_quota.max_objects=" << qinfo.max_objects
<< dendl;
}
const utime_t now = ceph_clock_now();
- if (expires_timestamp <= static_cast<uint64_t>(now.sec())) {
+ if (std::cmp_less_equal(expires_timestamp, now.sec())) {
ldpp_dout(this, 5) << "FormPost form expired: "
<< expires_timestamp << " <= " << now.sec() << dendl;
return false;