void otp_instance::trim_expired(const ceph::real_time& now)
{
- ceph::real_time window_start = now - make_timespan(otp.step_size);
+ ceph::real_time window_start = now - std::chrono::seconds(otp.step_size);
while (!last_checks.empty() &&
last_checks.front().timestamp < window_start) {
ceph::real_time now = real_clock::now();
trim_expired(now);
- for (auto entry : boost::adaptors::reverse(last_checks)) {
+ for (auto& entry : boost::adaptors::reverse(last_checks)) {
if (entry.token == token) {
*result = entry;
return;
bufferlist bl;
string key = otp_key_prefix + id;
- int r = cls_cxx_map_get_val(hctx, key.c_str(), &bl);
+ int r = cls_cxx_map_get_val(hctx, key, &bl);
if (r < 0) {
if (r != -ENOENT) {
CLS_ERR("error reading key %s: %d", key.c_str(), r);
bufferlist bl;
::encode(instance, bl);
- int r = cls_cxx_map_set_val(hctx, key.c_str(), &bl);
+ int r = cls_cxx_map_set_val(hctx, key, &bl);
if (r < 0) {
CLS_ERR("ERROR: %s(): failed to store key (otp id=%s, r=%d)", __func__, instance.otp.id.c_str(), r);
return r;
{
string key = otp_key_prefix + id;
- int r = cls_cxx_map_remove_key(hctx, key.c_str());
+ int r = cls_cxx_map_remove_key(hctx, key);
if (r < 0) {
CLS_ERR("ERROR: %s(): failed to remove key (otp id=%s, r=%d)", __func__, id.c_str(), r);
return r;
{
bufferlist bl;
::encode(h, bl);
- int r = cls_cxx_map_get_val(hctx, otp_header_key.c_str(), &bl);
+ int r = cls_cxx_map_get_val(hctx, otp_header_key, &bl);
if (r == -ENOENT || r == -ENODATA) {
*h = otp_header();
return 0;
bufferlist bl;
::encode(h, bl);
- int r = cls_cxx_map_set_val(hctx, otp_header_key.c_str(), &bl);
+ int r = cls_cxx_map_set_val(hctx, otp_header_key, &bl);
if (r < 0) {
CLS_ERR("failed to store header (r=%d)", r);
return r;
{
list<rados::cls::otp::otp_info_t> entries;
- cls_otp_set_otp_op() = default;
-
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
::encode(entries, bl);
string val;
string token;
- cls_otp_check_otp_op() = default;
-
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
::encode(id, bl);
{
string token;
- cls_otp_get_result_op() = default;
-
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
::encode(token, bl);
{
rados::cls::otp::otp_check_t result;
- cls_otp_get_result_reply() = default;
-
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
::encode(result, bl);
{
list<string> ids;
- cls_otp_remove_otp_op() = default;
-
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
::encode(ids, bl);
bool get_all{false};
list<string> ids;
- cls_otp_get_otp_op() = default;
-
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
::encode(get_all, bl);
{
list<rados::cls::otp::otp_info_t> found_entries;
- cls_otp_get_otp_reply() = default;
-
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
::encode(found_entries, bl);