CLS_VER(1,0)
CLS_NAME(2pc_queue)
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+
constexpr auto CLS_QUEUE_URGENT_DATA_XATTR_NAME = "cls_queue_urgent_data";
static int cls_2pc_queue_init(cls_method_context_t hctx, bufferlist *in, bufferlist *out) {
cls_queue_init_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_init: failed to decode entry: %s", err.what());
return -EINVAL;
}
try {
auto in_iter = in->cbegin();
decode(res_op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_reserve: failed to decode entry: %s", err.what());
return -EINVAL;
}
try {
auto in_iter = head.bl_urgent_data.cbegin();
decode(urgent_data, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_reserve: failed to decode entry: %s", err.what());
return -EINVAL;
}
auto iter = bl_xattrs.cbegin();
try {
decode(xattr_reservations, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_reserve: failed to decode xattrs urgent data map");
return -EINVAL;
} //end - catch
try {
auto in_iter = in->cbegin();
decode(commit_op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_commit: failed to decode entry: %s", err.what());
return -EINVAL;
}
try {
auto in_iter = head.bl_urgent_data.cbegin();
decode(urgent_data, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_commit: failed to decode entry: %s", err.what());
return -EINVAL;
}
auto iter = bl_xattrs.cbegin();
try {
decode(xattr_reservations, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_commit: failed to decode xattrs urgent data map");
return -EINVAL;
} //end - catch
try {
auto in_iter = in->cbegin();
decode(abort_op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_abort: failed to decode entry: %s", err.what());
return -EINVAL;
}
try {
auto in_iter = head.bl_urgent_data.cbegin();
decode(urgent_data, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_abort: failed to decode entry: %s", err.what());
return -EINVAL;
}
cls_2pc_reservations xattr_reservations;
try {
decode(xattr_reservations, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_abort: failed to decode xattrs urgent data map");
return -EINVAL;
} //end - catch
try {
auto in_iter = head.bl_urgent_data.cbegin();
decode(urgent_data, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_list_reservations: failed to decode entry: %s", err.what());
return -EINVAL;
}
auto iter = bl_xattrs.cbegin();
try {
decode(xattr_reservations, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_2pc_queue_list_reservations: failed to decode xattrs urgent data map");
return -EINVAL;
} //end - catch
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#pragma once
#include "include/types.h"
uint64_t size;
uint32_t entries;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(size, bl);
encode(entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(size, bl);
decode(entries, bl);
struct cls_2pc_queue_reserve_ret {
cls_2pc_reservation::id_t id; // allocated reservation id
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(id, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(id, bl);
DECODE_FINISH(bl);
struct cls_2pc_queue_commit_op {
cls_2pc_reservation::id_t id; // reservation to commit
- std::vector<bufferlist> bl_data_vec; // the data to enqueue
+ std::vector<ceph::buffer::list> bl_data_vec; // the data to enqueue
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(id, bl);
encode(bl_data_vec, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(id, bl);
decode(bl_data_vec, bl);
struct cls_2pc_queue_abort_op {
cls_2pc_reservation::id_t id; // reservation to abort
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(id, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(id, bl);
DECODE_FINISH(bl);
struct cls_2pc_queue_reservations_ret {
cls_2pc_reservations reservations; // reservation list (keyed by id)
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(reservations, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(reservations, bl);
DECODE_FINISH(bl);
}
};
WRITE_CLASS_ENCODER(cls_2pc_queue_reservations_ret)
-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
#pragma once
#include "include/types.h"
cls_2pc_reservation() = default;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(size, bl);
encode(timestamp, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(size, bl);
decode(timestamp, bl);
cls_2pc_reservations reservations; // reservation list (keyed by id)
bool has_xattrs{false};
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(reserved_size, bl);
encode(last_id, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(reserved_size, bl);
decode(last_id, bl);
}
};
WRITE_CLASS_ENCODER(cls_2pc_urgent_data)
-
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include <errno.h>
#include "include/compat.h"
#include "osd/osd_types.h"
+using ceph::bufferlist;
+using ceph::decode;
+
CLS_VER(1,0)
CLS_NAME(cas)
try {
auto iter = bl.cbegin();
decode(*objr, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: chunk_read_refcount(): failed to decode refcount entry\n");
return -EIO;
}
cls_chunk_refcount_get_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rc_refcount_get(): failed to decode entry\n");
return -EINVAL;
}
cls_chunk_refcount_put_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rc_chunk_refcount_put(): failed to decode entry\n");
return -EINVAL;
}
cls_chunk_refcount_set_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_chunk_refcount_set(): failed to decode entry\n");
return -EINVAL;
}
decode(src_obj, in_iter);
in_iter.copy(op.extent.length, indata);
}
- catch (buffer::error& e) {
+ catch (ceph::buffer::error& e) {
return -EINVAL;
}
static int cls_rc_has_chunk(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
auto in_iter = in->cbegin();
- string fp_oid;
+ std::string fp_oid;
bufferlist indata, outdata;
try {
decode (fp_oid, in_iter);
}
- catch (buffer::error& e) {
+ catch (ceph::buffer::error& e) {
return -EINVAL;
}
CLS_LOG(10, " fp_oid: %s \n", fp_oid.c_str());
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#include <errno.h>
#include "cls/cas/cls_cas_client.h"
#include "cls/cas/cls_cas_ops.h"
#include "include/rados/librados.hpp"
-using namespace librados;
+using std::set;
+using std::string;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
void cls_chunk_refcount_get(librados::ObjectWriteOperation& op, const hobject_t& soid)
{
try {
auto iter = out.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_CAS_CLIENT_H
#define CEPH_CLS_CAS_CLIENT_H
#include "include/rados/librados_fwd.hpp"
#include "common/hobject.h"
-void cls_chunk_refcount_get(librados::ObjectWriteOperation& op, const hobject_t& soid);
+void cls_chunk_refcount_get(librados::ObjectWriteOperation& op,const hobject_t& soid);
void cls_chunk_refcount_put(librados::ObjectWriteOperation& op, const hobject_t& soid);
-void cls_chunk_refcount_set(librados::ObjectWriteOperation& op, set<hobject_t>& refs);
-int cls_chunk_refcount_read(librados::IoCtx& io_ctx, string& oid, set<hobject_t> *refs);
-int cls_chunk_has_chunk(librados::IoCtx& io_ctx, string& oid, string& fp_oid);
+void cls_chunk_refcount_set(librados::ObjectWriteOperation& op, std::set<hobject_t>& refs);
+int cls_chunk_refcount_read(librados::IoCtx& io_ctx, std::string& oid, std::set<hobject_t> *refs);
+int cls_chunk_has_chunk(librados::IoCtx& io_ctx, std::string& oid, std::string& fp_oid);
#endif
cls_chunk_refcount_get_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(source, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(source, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_chunk_refcount_get_op*>& ls);
+ static void generate_test_instances(std::list<cls_chunk_refcount_get_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_chunk_refcount_get_op)
cls_chunk_refcount_put_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(source, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(source, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_chunk_refcount_put_op*>& ls);
+ static void generate_test_instances(std::list<cls_chunk_refcount_put_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_chunk_refcount_put_op)
struct cls_chunk_refcount_set_op {
- set<hobject_t> refs;
+ std::set<hobject_t> refs;
cls_chunk_refcount_set_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(refs, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(refs, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_chunk_refcount_set_op*>& ls);
+ static void generate_test_instances(std::list<cls_chunk_refcount_set_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_chunk_refcount_set_op)
struct cls_chunk_refcount_read_ret {
- set<hobject_t> refs;
+ std::set<hobject_t> refs;
cls_chunk_refcount_read_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(refs, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(refs, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_chunk_refcount_read_ret*>& ls);
+ static void generate_test_instances(std::list<cls_chunk_refcount_read_ret*>& ls);
};
WRITE_CLASS_ENCODER(cls_chunk_refcount_read_ret)
struct chunk_obj_refcount {
- set<hobject_t> refs;
+ std::set<hobject_t> refs;
chunk_obj_refcount() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(refs, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(refs, bl);
DECODE_FINISH(bl);
WRITE_CLASS_ENCODER(chunk_obj_refcount)
struct obj_refcount {
- map<string, bool> refs;
- set<string> retired_refs;
+ std::map<std::string, bool> refs;
+ std::set<std::string> retired_refs;
obj_refcount() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(refs, bl);
encode(retired_refs, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(refs, bl);
if (struct_v >= 2) {
CLS_VER(1,0)
CLS_NAME(cephfs)
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
std::ostream &operator<<(std::ostream &out, const ObjCeiling &in)
{
// Valid existing value, do comparison
set_val = input_val > existing_val;
}
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
// Corrupt or empty existing value, overwrite it
set_val = true;
}
AccumulateArgs args;
try {
args.decode(q);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
InodeTagFilterArgs args;
args.decode(params);
scrub_tag = args.scrub_tag;
- } catch (buffer::error &e) {
+ } catch (ceph::buffer::error &e) {
return -EINVAL;
}
decode(tag_ondisk, q);
if (tag_ondisk == scrub_tag)
return false;
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
}
}
return id > rhs.id;
}
- void encode(bufferlist &bl) const
+ void encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(id, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &p)
+ void decode(ceph::buffer::list::const_iterator &p)
{
DECODE_START(1, p);
decode(id, p);
: obj_index(0), obj_size(0), mtime(0)
{}
- void encode(bufferlist &bl) const
+ void encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(obj_xattr_name, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl)
+ void decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(obj_xattr_name, bl);
public:
std::string scrub_tag;
- void encode(bufferlist &bl) const
+ void encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(scrub_tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl)
+ void decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(scrub_tag, bl);
#include "cls_cephfs_client.h"
+using ceph::bufferlist;
+using ceph::decode;
+
#define XATTR_CEILING "scan_ceiling"
#define XATTR_MAX_MTIME "scan_max_mtime"
#define XATTR_MAX_SIZE "scan_max_size"
ceiling.decode(scan_ceiling_bl_iter);
result->ceiling_obj_index = ceiling.id;
result->ceiling_obj_size = ceiling.size;
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
//dout(4) << "Invalid size attr on '" << oid << "'" << dendl;
return -EINVAL;
}
try {
auto scan_max_size_bl_iter = scan_max_size_bl.cbegin();
decode(result->max_obj_size, scan_max_size_bl_iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
//dout(4) << "Invalid size attr on '" << oid << "'" << dendl;
return -EINVAL;
}
try {
auto scan_max_mtime_bl_iter = scan_max_mtime_bl.cbegin();
decode(result->max_mtime, scan_max_mtime_bl_iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
//dout(4) << "Invalid size attr on '" << oid << "'" << dendl;
return -EINVAL;
}
try {
auto q = parent_bl.cbegin();
backtrace->decode(q);
- } catch (buffer::error &e) {
+ } catch (ceph::buffer::error &e) {
//dout(4) << "Corrupt backtrace on '" << oid << "': " << e << dendl;
return -EINVAL;
}
try {
auto q = layout_bl.cbegin();
decode(*layout, q);
- } catch (buffer::error &e) {
+ } catch (ceph::buffer::error &e) {
return -EINVAL;
}
}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
#include "include/rados/librados_fwd.hpp"
#include "mds/mdstypes.h"
static void build_tag_filter(
const std::string &scrub_tag,
- bufferlist *out_bl);
+ ceph::buffer::list *out_bl);
};
-
#include "objclass/objclass.h"
#include "osd/osd_types.h"
-using ceph::bufferlist;
using std::string;
+using std::ostringstream;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
CLS_VER(1,0)
CLS_NAME(hello)
try {
decode(xattr, params);
decode(val, params);
- } catch (buffer::error &e) {
+ } catch (ceph::buffer::error &e) {
return -EINVAL;
}
return 0;
CLS_VER(1, 0)
CLS_NAME(journal)
+using std::string;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+
namespace {
static const uint64_t MAX_KEYS_READ = 64;
try {
auto iter = bl.cbegin();
decode(*t, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
auto iter = val.second.cbegin();
try {
decode(client, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding registered client: %s",
val.first.c_str());
return -EIO;
auto iter = val.second.cbegin();
try {
decode(tag, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding tag: %s", val.first.c_str());
return -EIO;
}
cls::journal::Client client;
decode(client, iter);
clients->insert(client);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode client '%s': %s", it->first.c_str(),
err.what());
return -EIO;
decode(order, iter);
decode(splay_width, iter);
decode(pool_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(object_set, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(object_set, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
auto iter = in->cbegin();
decode(id, iter);
decode(data, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
auto iter = in->cbegin();
decode(id, iter);
decode(data, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
uint8_t state_raw;
decode(state_raw, iter);
state = static_cast<cls::journal::ClientState>(state_raw);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
auto iter = in->cbegin();
decode(id, iter);
decode(commit_position, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(tag_tid, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
decode(tag_tid, iter);
decode(tag_class, iter);
decode(data, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
decode(max_return, iter);
decode(client_id, iter);
decode(tag_class, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
auto iter = val.second.cbegin();
try {
decode(tag, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding tag: %s", val.first.c_str());
return -EIO;
}
try {
auto iter = in->cbegin();
decode(soft_max_size, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
auto iter = in->cbegin();
decode(soft_max_size, iter);
decode(data, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode input parameters: %s", err.what());
return -EINVAL;
}
#include "include/stringify.h"
#include "common/Formatter.h"
+using ceph::bufferlist;
+using ceph::Formatter;
+
namespace cls {
namespace journal {
#include "include/compat.h"
+using std::map;
+using std::string;
+using ceph::bufferlist;
using namespace rados::cls::lock;
-
CLS_VER(1,0)
CLS_NAME(lock)
try {
auto it = bl.cbegin();
decode(*lock, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding %s", key.c_str());
return -EIO;
}
utime_t now = ceph_clock_now();
- map<locker_id_t, locker_info_t>::iterator iter = lock->lockers.begin();
+ auto iter = lock->lockers.begin();
while (iter != lock->lockers.end()) {
struct locker_info_t& info = iter->second;
return r;
}
- map<locker_id_t, locker_info_t>& lockers = linfo.lockers;
- map<locker_id_t, locker_info_t>::iterator iter;
+ auto& lockers = linfo.lockers;
locker_id_t id;
id.cookie = cookie;
ClsLockType existing_lock_type = linfo.lock_type;
CLS_LOG(20, "existing_lock_type=%s", cls_lock_type_str(existing_lock_type));
- iter = lockers.find(id);
+ auto iter = lockers.find(id);
if (iter != lockers.end()) {
if (fail_if_exists && !fail_if_does_not_exist) {
return -EEXIST;
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
return r;
}
- map<locker_id_t, locker_info_t>& lockers = linfo.lockers;
+ auto& lockers = linfo.lockers;
struct locker_id_t id(locker, cookie);
// remove named locker from set
- map<locker_id_t, locker_info_t>::iterator iter = lockers.find(id);
+ auto iter = lockers.find(id);
if (iter == lockers.end()) { // no such key
CLS_LOG(10, "locker %s [name: %s.%ld, cookie: %s] does not exist", name.c_str(),
locker.type_str(), locker.num(), cookie.c_str());
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
return -EINVAL;
}
struct cls_lock_get_info_reply ret;
- map<locker_id_t, locker_info_t>::iterator iter;
- for (iter = linfo.lockers.begin(); iter != linfo.lockers.end(); ++iter) {
+ for (auto iter = linfo.lockers.begin(); iter != linfo.lockers.end(); ++iter) {
ret.lockers[iter->first] = iter->second;
}
ret.lock_type = linfo.lock_type;
cls_lock_list_locks_reply ret;
- map<string, bufferlist>::iterator iter;
size_t pos = sizeof(LOCK_PREFIX) - 1;
- for (iter = attrs.begin(); iter != attrs.end(); ++iter) {
+ for (auto iter = attrs.begin(); iter != attrs.end(); ++iter) {
const string& attr = iter->first;
if (attr.substr(0, pos).compare(LOCK_PREFIX) == 0) {
ret.locks.push_back(attr.substr(pos));
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
return -EINVAL;
}
id.cookie = op.cookie;
id.locker = inst.name;
- map<locker_id_t, locker_info_t>::iterator iter = linfo.lockers.find(id);
+ auto iter = linfo.lockers.find(id);
if (iter == linfo.lockers.end()) {
CLS_LOG(20, "not locked by assert client");
return -EBUSY;
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
return -EINVAL;
}
#include "msg/msg_types.h"
#include "include/rados/librados.hpp"
#include "include/utime.h"
-
-using namespace librados;
#include "cls/lock/cls_lock_ops.h"
#include "cls/lock/cls_lock_client.h"
+using std::map;
+
+using namespace librados;
+
+
namespace rados {
namespace cls {
namespace lock {
void lock(ObjectWriteOperation *rados_op,
- const string& name, ClsLockType type,
- const string& cookie, const string& tag,
- const string& description,
+ const std::string& name, ClsLockType type,
+ const std::string& cookie, const std::string& tag,
+ const std::string& description,
const utime_t& duration, uint8_t flags)
{
cls_lock_lock_op op;
}
int lock(IoCtx *ioctx,
- const string& oid,
- const string& name, ClsLockType type,
- const string& cookie, const string& tag,
- const string& description, const utime_t& duration,
+ const std::string& oid,
+ const std::string& name, ClsLockType type,
+ const std::string& cookie, const std::string& tag,
+ const std::string& description, const utime_t& duration,
uint8_t flags)
{
ObjectWriteOperation op;
}
void unlock(ObjectWriteOperation *rados_op,
- const string& name, const string& cookie)
+ const std::string& name, const std::string& cookie)
{
cls_lock_unlock_op op;
op.name = name;
rados_op->exec("lock", "unlock", in);
}
- int unlock(IoCtx *ioctx, const string& oid,
- const string& name, const string& cookie)
+ int unlock(IoCtx *ioctx, const std::string& oid,
+ const std::string& name, const std::string& cookie)
{
ObjectWriteOperation op;
unlock(&op, name, cookie);
return ioctx->operate(oid, &op);
}
- int aio_unlock(IoCtx *ioctx, const string& oid,
- const string& name, const string& cookie,
+ int aio_unlock(IoCtx *ioctx, const std::string& oid,
+ const std::string& name, const std::string& cookie,
librados::AioCompletion *completion)
{
ObjectWriteOperation op;
}
void break_lock(ObjectWriteOperation *rados_op,
- const string& name, const string& cookie,
+ const std::string& name, const std::string& cookie,
const entity_name_t& locker)
{
cls_lock_break_op op;
rados_op->exec("lock", "break_lock", in);
}
- int break_lock(IoCtx *ioctx, const string& oid,
- const string& name, const string& cookie,
+ int break_lock(IoCtx *ioctx, const std::string& oid,
+ const std::string& name, const std::string& cookie,
const entity_name_t& locker)
{
ObjectWriteOperation op;
return ioctx->operate(oid, &op);
}
- int list_locks(IoCtx *ioctx, const string& oid, list<string> *locks)
+ int list_locks(IoCtx *ioctx, const std::string& oid, std::list<std::string> *locks)
{
bufferlist in, out;
int r = ioctx->exec(oid, "lock", "list_locks", in, out);
return r;
cls_lock_list_locks_reply ret;
- auto iter = cbegin(out);
+ auto iter = std::cbegin(out);
try {
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EBADMSG;
}
}
void get_lock_info_start(ObjectReadOperation *rados_op,
- const string& name)
+ const std::string& name)
{
bufferlist in;
cls_lock_get_info_op op;
int get_lock_info_finish(bufferlist::const_iterator *iter,
map<locker_id_t, locker_info_t> *lockers,
- ClsLockType *type, string *tag)
+ ClsLockType *type, std::string *tag)
{
cls_lock_get_info_reply ret;
try {
decode(ret, *iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EBADMSG;
}
return 0;
}
- int get_lock_info(IoCtx *ioctx, const string& oid, const string& name,
+ int get_lock_info(IoCtx *ioctx, const std::string& oid, const std::string& name,
map<locker_id_t, locker_info_t> *lockers,
- ClsLockType *type, string *tag)
+ ClsLockType *type, std::string *tag)
{
ObjectReadOperation op;
get_lock_info_start(&op, name);
cookie, tag, description, duration, flags);
}
- int Lock::lock_shared(IoCtx *ioctx, const string& oid)
+ int Lock::lock_shared(IoCtx *ioctx, const std::string& oid)
{
return lock(ioctx, oid, name, LOCK_SHARED,
cookie, tag, description, duration, flags);
cookie, tag, description, duration, flags);
}
- int Lock::lock_exclusive(IoCtx *ioctx, const string& oid)
+ int Lock::lock_exclusive(IoCtx *ioctx, const std::string& oid)
{
return lock(ioctx, oid, name, LOCK_EXCLUSIVE,
cookie, tag, description, duration, flags);
cookie, tag, description, duration, flags);
}
- int Lock::lock_exclusive_ephemeral(IoCtx *ioctx, const string& oid)
+ int Lock::lock_exclusive_ephemeral(IoCtx *ioctx, const std::string& oid)
{
return lock(ioctx, oid, name, LOCK_EXCLUSIVE_EPHEMERAL,
cookie, tag, description, duration, flags);
rados::cls::lock::unlock(op, name, cookie);
}
- int Lock::unlock(IoCtx *ioctx, const string& oid)
+ int Lock::unlock(IoCtx *ioctx, const std::string& oid)
{
return rados::cls::lock::unlock(ioctx, oid, name, cookie);
}
rados::cls::lock::break_lock(op, name, cookie, locker);
}
- int Lock::break_lock(IoCtx *ioctx, const string& oid, const entity_name_t& locker)
+ int Lock::break_lock(IoCtx *ioctx, const std::string& oid, const entity_name_t& locker)
{
return rados::cls::lock::break_lock(ioctx, oid, name, cookie, locker);
}
} // namespace lock
} // namespace cls
} // namespace rados
-
const entity_name_t& locker);
extern int list_locks(librados::IoCtx *ioctx, const std::string& oid,
- list<std::string> *locks);
+ std::list<std::string> *locks);
extern void get_lock_info_start(librados::ObjectReadOperation *rados_op,
const std::string& name);
extern int get_lock_info_finish(ceph::bufferlist::const_iterator *out,
- map<locker_id_t, locker_info_t> *lockers,
+ std::map<locker_id_t, locker_info_t> *lockers,
ClsLockType *type, std::string *tag);
extern int get_lock_info(librados::IoCtx *ioctx, const std::string& oid,
const std::string& name,
- map<locker_id_t, locker_info_t> *lockers,
+ std::map<locker_id_t, locker_info_t> *lockers,
ClsLockType *type, std::string *tag);
extern void assert_locked(librados::ObjectOperation *rados_op,
struct cls_lock_lock_op
{
- string name;
+ std::string name;
ClsLockType type;
- string cookie;
- string tag;
- string description;
+ std::string cookie;
+ std::string tag;
+ std::string description;
utime_t duration;
uint8_t flags;
cls_lock_lock_op() : type(LOCK_NONE), flags(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(name, bl);
uint8_t t = (uint8_t)type;
encode(flags, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
decode(name, bl);
uint8_t t;
decode(flags, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_lock_lock_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_lock_lock_op*>& o);
};
WRITE_CLASS_ENCODER(cls_lock_lock_op)
struct cls_lock_unlock_op
{
- string name;
- string cookie;
+ std::string name;
+ std::string cookie;
cls_lock_unlock_op() {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(name, bl);
encode(cookie, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
decode(name, bl);
decode(cookie, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_lock_unlock_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_lock_unlock_op*>& o);
};
WRITE_CLASS_ENCODER(cls_lock_unlock_op)
struct cls_lock_break_op
{
- string name;
+ std::string name;
entity_name_t locker;
- string cookie;
+ std::string cookie;
cls_lock_break_op() {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(name, bl);
encode(locker, bl);
encode(cookie, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
decode(name, bl);
decode(locker, bl);
decode(cookie, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_lock_break_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_lock_break_op*>& o);
};
WRITE_CLASS_ENCODER(cls_lock_break_op)
struct cls_lock_get_info_op
{
- string name;
+ std::string name;
cls_lock_get_info_op() {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(name, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
decode(name, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_lock_get_info_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_lock_get_info_op*>& o);
};
WRITE_CLASS_ENCODER(cls_lock_get_info_op)
struct cls_lock_get_info_reply
{
- map<rados::cls::lock::locker_id_t, rados::cls::lock::locker_info_t> lockers;
+ std::map<rados::cls::lock::locker_id_t, rados::cls::lock::locker_info_t> lockers;
ClsLockType lock_type;
- string tag;
+ std::string tag;
cls_lock_get_info_reply() : lock_type(LOCK_NONE) {}
- void encode(bufferlist &bl, uint64_t features) const {
+ void encode(ceph::buffer::list &bl, uint64_t features) const {
ENCODE_START(1, 1, bl);
encode(lockers, bl, features);
uint8_t t = (uint8_t)lock_type;
encode(tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
decode(lockers, bl);
uint8_t t;
decode(tag, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_lock_get_info_reply*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_lock_get_info_reply*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(cls_lock_get_info_reply)
struct cls_lock_list_locks_reply
{
- list<string> locks;
+ std::list<std::string> locks;
cls_lock_list_locks_reply() {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(locks, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
decode(locks, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_lock_list_locks_reply*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_lock_list_locks_reply*>& o);
};
WRITE_CLASS_ENCODER(cls_lock_list_locks_reply)
struct cls_lock_assert_op
{
- string name;
+ std::string name;
ClsLockType type;
- string cookie;
- string tag;
+ std::string cookie;
+ std::string tag;
cls_lock_assert_op() : type(LOCK_NONE) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(name, bl);
uint8_t t = (uint8_t)type;
encode(tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
decode(name, bl);
uint8_t t;
decode(tag, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_lock_assert_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_lock_assert_op*>& o);
};
WRITE_CLASS_ENCODER(cls_lock_assert_op)
struct cls_lock_set_cookie_op
{
- string name;
+ std::string name;
ClsLockType type;
- string cookie;
- string tag;
- string new_cookie;
+ std::string cookie;
+ std::string tag;
+ std::string new_cookie;
cls_lock_set_cookie_op() : type(LOCK_NONE) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(name, bl);
uint8_t t = (uint8_t)type;
encode(new_cookie, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
decode(name, bl);
uint8_t t;
decode(new_cookie, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_lock_set_cookie_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_lock_set_cookie_op*>& o);
};
WRITE_CLASS_ENCODER(cls_lock_set_cookie_op)
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
- *
+ *
*/
#include "common/Formatter.h"
using namespace rados::cls::lock;
-static void generate_lock_id(locker_id_t& i, int n, const string& cookie)
+static void generate_lock_id(locker_id_t& i, int n, const std::string& cookie)
{
i.locker = entity_name_t::CLIENT(n);
i.cookie = cookie;
}
-void locker_id_t::dump(Formatter *f) const
+void locker_id_t::dump(ceph::Formatter *f) const
{
f->dump_stream("locker") << locker;
f->dump_string("cookie", cookie);
}
-void locker_id_t::generate_test_instances(list<locker_id_t*>& o)
+void locker_id_t::generate_test_instances(std::list<locker_id_t*>& o)
{
locker_id_t *i = new locker_id_t;
generate_lock_id(*i, 1, "cookie");
o.push_back(new locker_id_t);
}
-void locker_info_t::dump(Formatter *f) const
+void locker_info_t::dump(ceph::Formatter *f) const
{
f->dump_stream("expiration") << expiration;
f->dump_string("addr", addr.get_legacy_str());
a.set_port(port);
}
-void locker_info_t::generate_test_instances(list<locker_info_t*>& o)
+void locker_info_t::generate_test_instances(std::list<locker_info_t*>& o)
{
locker_info_t *i = new locker_info_t;
i->expiration = utime_t(5, 0);
o.push_back(new locker_info_t);
}
-void lock_info_t::dump(Formatter *f) const
+void lock_info_t::dump(ceph::Formatter *f) const
{
f->dump_int("lock_type", lock_type);
f->dump_string("tag", tag);
f->close_section();
}
-void lock_info_t::generate_test_instances(list<lock_info_t *>& o)
+void lock_info_t::generate_test_instances(std::list<lock_info_t *>& o)
{
lock_info_t *i = new lock_info_t;
locker_id_t id;
return true;
return false;
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
friend std::ostream& operator<<(std::ostream& out,
const locker_id_t& data) {
out << data.locker;
return out;
}
- static void generate_test_instances(list<locker_id_t*>& o);
+ static void generate_test_instances(std::list<locker_id_t*>& o);
};
WRITE_CLASS_ENCODER(locker_id_t)
decode(description, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
friend std::ostream& operator<<(std::ostream& out,
const locker_info_t& data) {
+ using ceph::operator <<;
out << "{addr:" << data.addr << ", exp:";
const auto& exp = data.expiration;
return out;
}
- static void generate_test_instances(list<locker_info_t *>& o);
+ static void generate_test_instances(std::list<locker_info_t *>& o);
};
WRITE_CLASS_ENCODER_FEATURES(locker_info_t)
struct lock_info_t {
- map<locker_id_t, locker_info_t> lockers; // map of lockers
+ std::map<locker_id_t, locker_info_t> lockers; // map of lockers
ClsLockType lock_type; // lock type (exclusive / shared)
std::string tag; // tag: operations on lock can only succeed with this tag
// as long as set of non expired lockers
DECODE_FINISH(bl);
}
lock_info_t() : lock_type(LOCK_NONE) {}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<lock_info_t *>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<lock_info_t *>& o);
};
WRITE_CLASS_ENCODER_FEATURES(lock_info_t);
}
#include "global/global_context.h"
#include "include/compat.h"
+using std::map;
+using std::string;
+
+using ceph::bufferlist;
+
CLS_VER(1,0)
CLS_NAME(log)
auto iter = header_bl.cbegin();
try {
decode(header, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: read_header(): failed to decode header");
}
cls_log_add_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_log_add_op(): failed to decode op");
return -EINVAL;
}
if (ret < 0)
return ret;
- for (list<cls_log_entry>::iterator iter = op.entries.begin();
- iter != op.entries.end(); ++iter) {
+ for (auto iter = op.entries.begin(); iter != op.entries.end(); ++iter) {
cls_log_entry& entry = *iter;
string index;
cls_log_list_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_log_list_op(): failed to decode op");
return -EINVAL;
}
if (rc < 0)
return rc;
- list<cls_log_entry>& entries = ret.entries;
- map<string, bufferlist>::iterator iter = keys.begin();
+ auto& entries = ret.entries;
+ auto iter = keys.begin();
string marker;
cls_log_entry e;
decode(e, biter);
entries.push_back(e);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: cls_log_list: could not decode entry, index=%s", index.c_str());
}
}
cls_log_trim_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: cls_log_trim(): failed to decode entry");
return -EINVAL;
}
cls_log_info_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_log_add_op(): failed to decode op");
return -EINVAL;
}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
#include <errno.h>
#include "cls/log/cls_log_ops.h"
#include "include/compat.h"
+using std::list;
+using std::string;
+
+using ceph::bufferlist;
+
using namespace librados;
*truncated = ret.truncated;
if (marker)
*marker = std::move(ret.marker);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
// nothing we can do about it atm
}
}
decode(ret, iter);
if (header)
*header = ret.header;
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
// nothing we can do about it atm
}
}
op.exec("log", "info", inbl, new LogInfoCtx(header));
}
-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_LOG_CLIENT_H
#define CEPH_CLS_LOG_CLIENT_H
*/
void cls_log_add_prepare_entry(cls_log_entry& entry, const utime_t& timestamp,
- const string& section, const string& name, bufferlist& bl);
+ const std::string& section, const std::string& name, ceph::buffer::list& bl);
-void cls_log_add(librados::ObjectWriteOperation& op, list<cls_log_entry>& entries, bool monotonic_inc);
+void cls_log_add(librados::ObjectWriteOperation& op, std::list<cls_log_entry>& entries, bool monotonic_inc);
void cls_log_add(librados::ObjectWriteOperation& op, cls_log_entry& entry);
void cls_log_add(librados::ObjectWriteOperation& op, const utime_t& timestamp,
- const string& section, const string& name, bufferlist& bl);
+ const std::string& section, const std::string& name, ceph::buffer::list& bl);
void cls_log_list(librados::ObjectReadOperation& op, utime_t& from, utime_t& to,
- const string& in_marker, int max_entries,
- list<cls_log_entry>& entries,
- string *out_marker, bool *truncated);
+ const std::string& in_marker, int max_entries,
+ std::list<cls_log_entry>& entries,
+ std::string *out_marker, bool *truncated);
void cls_log_trim(librados::ObjectWriteOperation& op, const utime_t& from_time, const utime_t& to_time,
- const string& from_marker, const string& to_marker);
+ const std::string& from_marker, const std::string& to_marker);
// these overloads which call io_ctx.operate() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_log_trim(librados::IoCtx& io_ctx, const string& oid, const utime_t& from_time, const utime_t& to_time,
- const string& from_marker, const string& to_marker);
+int cls_log_trim(librados::IoCtx& io_ctx, const std::string& oid, const utime_t& from_time, const utime_t& to_time,
+ const std::string& from_marker, const std::string& to_marker);
#endif
void cls_log_info(librados::ObjectReadOperation& op, cls_log_header *header);
#include "cls_log_types.h"
struct cls_log_add_op {
- list<cls_log_entry> entries;
+ std::list<cls_log_entry> entries;
bool monotonic_inc;
cls_log_add_op() : monotonic_inc(true) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(entries, bl);
encode(monotonic_inc, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(entries, bl);
if (struct_v >= 2) {
struct cls_log_list_op {
utime_t from_time;
- string marker; /* if not empty, overrides from_time */
+ std::string marker; /* if not empty, overrides from_time */
utime_t to_time; /* not inclusive */
int max_entries; /* upperbound to returned num of entries
might return less than that and still be truncated */
cls_log_list_op() : max_entries(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(from_time, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(from_time, bl);
decode(marker, bl);
WRITE_CLASS_ENCODER(cls_log_list_op)
struct cls_log_list_ret {
- list<cls_log_entry> entries;
- string marker;
+ std::list<cls_log_entry> entries;
+ std::string marker;
bool truncated;
cls_log_list_ret() : truncated(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
decode(marker, bl);
struct cls_log_trim_op {
utime_t from_time;
utime_t to_time; /* inclusive */
- string from_marker;
- string to_marker;
+ std::string from_marker;
+ std::string to_marker;
cls_log_trim_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(from_time, bl);
encode(to_time, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(from_time, bl);
decode(to_time, bl);
struct cls_log_info_op {
cls_log_info_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
// currently empty request
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
// currently empty request
DECODE_FINISH(bl);
struct cls_log_info_ret {
cls_log_header header;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(header, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(header, bl);
DECODE_FINISH(bl);
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
#ifndef CEPH_CLS_LOG_TYPES_H
#define CEPH_CLS_LOG_TYPES_H
struct cls_log_entry {
- string id;
- string section;
- string name;
+ std::string id;
+ std::string section;
+ std::string name;
utime_t timestamp;
- bufferlist data;
+ ceph::buffer::list data;
cls_log_entry() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(section, bl);
encode(name, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(section, bl);
decode(name, bl);
WRITE_CLASS_ENCODER(cls_log_entry)
struct cls_log_header {
- string max_marker;
+ std::string max_marker;
utime_t max_time;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(max_marker, bl);
encode(max_time, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(max_marker, bl);
decode(max_time, bl);
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
try {
decode(key, iter);
decode(diff_str, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "add: invalid decode of input");
return -EINVAL;
}
try {
decode(key, iter);
decode(diff_str, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "mul: invalid decode of input");
return -EINVAL;
}
#include "cls/otp/cls_otp_ops.h"
#include "cls/otp/cls_otp_types.h"
+using std::list;
+using std::string;
+using std::set;
+
+using ceph::bufferlist;
+using ceph::encode;
+using ceph::real_clock;
using namespace rados::cls::otp;
void otp_instance::find(const string& token, otp_check_t *result)
{
- ceph::real_time now = real_clock::now();
+ auto now = real_clock::now();
trim_expired(now);
for (auto& entry : boost::adaptors::reverse(last_checks)) {
try {
auto it = bl.cbegin();
decode(*instance, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("ERROR: failed to decode %s", key.c_str());
return -EIO;
}
auto iter = bl.cbegin();
try {
decode(*h, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_ERR("failed to decode otp_header");
return -EIO;
}
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(op, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
#include "msg/msg_types.h"
#include "include/rados/librados.hpp"
#include "include/utime.h"
-
+
+using std::list;
+using std::string;
using namespace librados;
#include "cls/otp/cls_otp_ops.h"
cls_otp_get_result_reply ret;
try {
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EBADMSG;
}
auto iter = out.cbegin();
try {
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EBADMSG;
}
auto iter = out.cbegin();
try {
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EBADMSG;
}
} // namespace otp
} // namespace cls
} // namespace rados
-
class OTP {
public:
static void create(librados::ObjectWriteOperation *op, const otp_info_t& config);
- static void set(librados::ObjectWriteOperation *op, const list<otp_info_t>& entries);
- static void remove(librados::ObjectWriteOperation *op, const string& id);
+ static void set(librados::ObjectWriteOperation *op, const std::list<otp_info_t>& entries);
+ static void remove(librados::ObjectWriteOperation *op, const std::string& id);
static int get(librados::ObjectReadOperation *op,
- librados::IoCtx& ioctx, const string& oid,
- const string& id, otp_info_t *result);
+ librados::IoCtx& ioctx, const std::string& oid,
+ const std::string& id, otp_info_t *result);
static int get_all(librados::ObjectReadOperation *op,
- librados::IoCtx& ioctx, const string& oid,
- list<otp_info_t> *result);
+ librados::IoCtx& ioctx, const std::string& oid,
+ std::list<otp_info_t> *result);
// these overloads which call io_ctx.operate() or io_ctx.exec() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()/exec()
#ifndef CLS_CLIENT_HIDE_IOCTX
static int get(librados::ObjectReadOperation *op,
- librados::IoCtx& ioctx, const string& oid,
- const list<string> *ids, bool get_all, list<otp_info_t> *result);
- static int check(CephContext *cct, librados::IoCtx& ioctx, const string& oid,
- const string& id, const string& val, otp_check_t *result);
- static int get_current_time(librados::IoCtx& ioctx, const string& oid,
+ librados::IoCtx& ioctx, const std::string& oid,
+ const std::list<std::string> *ids, bool get_all, std::list<otp_info_t> *result);
+ static int check(CephContext *cct, librados::IoCtx& ioctx, const std::string& oid,
+ const std::string& id, const std::string& val, otp_check_t *result);
+ static int get_current_time(librados::IoCtx& ioctx, const std::string& oid,
ceph::real_time *result);
#endif
};
class TOTPConfig {
otp_info_t config;
public:
- TOTPConfig(const string& id, const string& seed) {
+ TOTPConfig(const std::string& id, const std::string& seed) {
config.type = OTP_TOTP;
config.id = id;
config.seed = seed;
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_OTP_OPS_H
#define CEPH_CLS_OTP_OPS_H
struct cls_otp_set_otp_op
{
- list<rados::cls::otp::otp_info_t> entries;
+ std::list<rados::cls::otp::otp_info_t> entries;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(entries, bl);
DECODE_FINISH(bl);
struct cls_otp_check_otp_op
{
- string id;
- string val;
- string token;
+ std::string id;
+ std::string val;
+ std::string token;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(id, bl);
encode(val, bl);
encode(token, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(id, bl);
decode(val, bl);
struct cls_otp_get_result_op
{
- string token;
+ std::string token;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(token, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(token, bl);
DECODE_FINISH(bl);
{
rados::cls::otp::otp_check_t result;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(result, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(result, bl);
DECODE_FINISH(bl);
struct cls_otp_remove_otp_op
{
- list<string> ids;
+ std::list<std::string> ids;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(ids, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(ids, bl);
DECODE_FINISH(bl);
struct cls_otp_get_otp_op
{
bool get_all{false};
- list<string> ids;
+ std::list<std::string> ids;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(get_all, bl);
encode(ids, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(get_all, bl);
decode(ids, bl);
struct cls_otp_get_otp_reply
{
- list<rados::cls::otp::otp_info_t> found_entries;
+ std::list<rados::cls::otp::otp_info_t> found_entries;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(found_entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(found_entries, bl);
DECODE_FINISH(bl);
struct cls_otp_get_current_time_op
{
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
DECODE_FINISH(bl);
}
{
ceph::real_time time;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(time, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(time, bl);
DECODE_FINISH(bl);
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
+ * License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
- *
+ *
*/
#include "objclass/objclass.h"
#include "cls/otp/cls_otp_types.h"
+using std::string;
+
+using ceph::Formatter;
+
using namespace rados::cls::otp;
void otp_info_t::dump(Formatter *f) const
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_OTP_TYPES_H
#define CEPH_CLS_OTP_TYPES_H
struct otp_info_t {
OTPType type{OTP_TOTP};
- string id;
- string seed;
+ std::string id;
+ std::string seed;
SeedType seed_type{OTP_SEED_UNKNOWN};
- bufferlist seed_bin; /* parsed seed, built automatically by otp_set_op,
+ ceph::buffer::list seed_bin; /* parsed seed, built automatically by otp_set_op,
* not being json encoded/decoded on purpose
*/
int32_t time_ofs{0};
otp_info_t() {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode((uint8_t)type, bl);
/* if we ever implement anything other than TOTP
encode(window, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
uint8_t t;
decode(t, bl);
decode(window, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
};
WRITE_CLASS_ENCODER(rados::cls::otp::otp_info_t)
};
struct otp_check_t {
- string token;
+ std::string token;
ceph::real_time timestamp;
OTPCheckResult result{OTP_CHECK_UNKNOWN};
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(token, bl);
encode(timestamp, bl);
encode((char)result, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(token, bl);
decode(timestamp, bl);
WRITE_CLASS_ENCODER(rados::cls::otp::otp_check_t)
struct otp_repo_t {
- map<string, otp_info_t> entries;
+ std::map<std::string, otp_info_t> entries;
otp_repo_t() {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(entries, bl);
DECODE_FINISH(bl);
#include "cls/queue/cls_queue_const.h"
#include "cls/queue/cls_queue_src.h"
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+
CLS_VER(1,0)
CLS_NAME(queue)
cls_queue_init_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_queue_init_op(): failed to decode entry\n");
return -EINVAL;
}
cls_queue_enqueue_op op;
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_queue_enqueue: failed to decode input data \n");
return -EINVAL;
}
cls_queue_list_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_queue_list_entries(): failed to decode input data\n");
return -EINVAL;
}
cls_queue_remove_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_queue_remove_entries: failed to decode input data\n");
return -EINVAL;
}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_QUEUE_OPS_H
#define CEPH_CLS_QUEUE_OPS_H
struct cls_queue_init_op {
uint64_t queue_size{0};
uint64_t max_urgent_data_size{0};
- bufferlist bl_urgent_data;
+ ceph::buffer::list bl_urgent_data;
cls_queue_init_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(queue_size, bl);
encode(max_urgent_data_size, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(queue_size, bl);
decode(max_urgent_data_size, bl);
WRITE_CLASS_ENCODER(cls_queue_init_op)
struct cls_queue_enqueue_op {
- vector<bufferlist> bl_data_vec;
+ std::vector<ceph::buffer::list> bl_data_vec;
cls_queue_enqueue_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(bl_data_vec, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(bl_data_vec, bl);
DECODE_FINISH(bl);
struct cls_queue_list_op {
uint64_t max;
- string start_marker;
+ std::string start_marker;
cls_queue_list_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(max, bl);
encode(start_marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(max, bl);
decode(start_marker, bl);
struct cls_queue_list_ret {
bool is_truncated;
- string next_marker;
- vector<cls_queue_entry> entries;
+ std::string next_marker;
+ std::vector<cls_queue_entry> entries;
cls_queue_list_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(is_truncated, bl);
encode(next_marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(is_truncated, bl);
decode(next_marker, bl);
WRITE_CLASS_ENCODER(cls_queue_list_ret)
struct cls_queue_remove_op {
- string end_marker;
+ std::string end_marker;
cls_queue_remove_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(end_marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(end_marker, bl);
DECODE_FINISH(bl);
cls_queue_get_capacity_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(queue_capacity, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(queue_capacity, bl);
DECODE_FINISH(bl);
};
WRITE_CLASS_ENCODER(cls_queue_get_capacity_ret)
-#endif /* CEPH_CLS_QUEUE_OPS_H */
\ No newline at end of file
+#endif /* CEPH_CLS_QUEUE_OPS_H */
#include "cls/queue/cls_queue_const.h"
#include "cls/queue/cls_queue_src.h"
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+
int queue_write_head(cls_method_context_t hctx, cls_queue_head& head)
{
bufferlist bl;
uint16_t queue_head_start;
try {
decode(queue_head_start, it);
- } catch (buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: queue_read_head: failed to decode queue start: %s", err.what());
return -EINVAL;
}
uint64_t encoded_len;
try {
decode(encoded_len, it);
- } catch (buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: queue_read_head: failed to decode encoded head size: %s", err.what());
return -EINVAL;
}
try {
decode(head, it);
- } catch (buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: queue_read_head: failed to decode head: %s", err.what());
return -EINVAL;
}
// Decode magic number at start
try {
decode(entry_start, it);
- } catch (buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
CLS_LOG(10, "ERROR: queue_list_entries: failed to decode entry start: %s", err.what());
return -EINVAL;
}
// Decode data size
try {
decode(data_size, it);
- } catch (buffer::error& err) {
+ } catch (const ceph::buffer::error& err) {
CLS_LOG(10, "ERROR: queue_list_entries: failed to decode data size: %s", err.what());
return -EINVAL;
}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_QUEUE_TYPES_H
#define CEPH_CLS_QUEUE_TYPES_H
struct cls_queue_entry
{
- bufferlist data;
+ ceph::buffer::list data;
std::string marker;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(data, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(data, bl);
decode(marker, bl);
uint64_t offset{0};
uint64_t gen{0};
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(gen, bl);
encode(offset, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(gen, bl);
decode(offset, bl);
DECODE_FINISH(bl);
}
- string to_str() {
- string marker = std::to_string(gen) + '/' + std::to_string(offset);
- return marker;
+ std::string to_str() {
+ return std::to_string(gen) + '/' + std::to_string(offset);
}
int from_str(const char* str) {
cls_queue_marker tail{QUEUE_START_OFFSET_1K, 0};
uint64_t queue_size{0}; // size of queue requested by user, with head size added to it
uint64_t max_urgent_data_size{0};
- bufferlist bl_urgent_data; // special data known to application using queue
+ ceph::buffer::list bl_urgent_data; // special data known to application using queue
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(max_head_size, bl);
encode(front, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(max_head_size, bl);
decode(front, bl);
#include <boost/algorithm/string/predicate.hpp>
+using std::istringstream;
+using std::ostringstream;
+using std::map;
+using std::set;
+using std::string;
+using std::vector;
+
+using ceph::BitVector;
+using ceph::bufferlist;
+using ceph::bufferptr;
+using ceph::encode;
+using ceph::decode;
+
/*
* Object keys:
*
try {
auto it = bl.cbegin();
decode(*out, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding %s", key.c_str());
return -EIO;
}
auto iter = val.second.cbegin();
try {
decode(snap_meta, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding snapshot metadata for snap : %s",
val.first.c_str());
return -EIO;
if (!iter.end()) {
decode(data_pool_id, iter);
}
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
if (!iter.end()) {
decode(read_only, iter);
}
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
decode(features, iter);
decode(mask, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(size, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "get_protection_status: invalid decode");
return -EINVAL;
}
try {
decode(snap_id, iter);
decode(status, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "set_protection_status: invalid decode");
return -EINVAL;
}
try {
decode(stripe_unit, iter);
decode(stripe_count, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "set_stripe_unit_count: invalid decode");
return -EINVAL;
}
try {
auto it = bl.cbegin();
decode(timestamp, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode create_timestamp");
return -EIO;
}
try {
auto it = bl.cbegin();
decode(timestamp, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode access_timestamp");
return -EIO;
}
try {
auto it = bl.cbegin();
decode(timestamp, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode modify_timestamp");
return -EIO;
}
auto iter = in->cbegin();
try {
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
if (!iter.end()) {
decode(snap_id, iter);
}
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
decode(op_features, iter);
decode(mask, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
uint64_t overlap;
decode(overlap, iter);
parent.head_overlap = overlap;
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "cls_rbd::set_parent: invalid decode");
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
if (!iter.end()) {
decode(reattach, iter);
}
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "cls_rbd::parent_attach: invalid decode");
return -EINVAL;
}
decode(*pool_id, it);
decode(*image_id, it);
decode(*snap_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding parent spec");
return -EINVAL;
}
return r;
try {
decode(*c_image_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding child image id");
return -EINVAL;
}
if (r < 0)
return r;
- for (set<string>::const_iterator it = keys.begin();
- it != keys.end(); ++it) {
+ for (auto it = keys.begin(); it != keys.end(); ++it) {
if ((*it).find(RBD_SNAP_KEY_PREFIX) != 0)
break;
snapid_t snap_id = snap_id_from_key(*it);
auto iter = in->cbegin();
try {
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
if (!iter.end()) {
decode(snap_meta.snapshot_namespace, iter);
}
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(src_snap_id, iter);
decode(dst_snap_name, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(extent_map, iter);
decode(data, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "sparse_copyup: invalid decode");
return -EINVAL;
}
bufferlist tmpbl;
try {
tmpbl.substr_of(data, data_offset, len);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_LOG(20, "sparse_copyup: invalid data");
return -EINVAL;
}
try {
auto iter = read_bl.cbegin();
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EIO;
}
try {
auto iter = in->cbegin();
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
decode(src, iter);
decode(dest, iter);
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(name, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
return r;
}
- for (map<string, bufferlist>::iterator it = vals.begin();
- it != vals.end(); ++it) {
+ for (auto it = vals.begin(); it != vals.end(); ++it) {
string id;
auto iter = it->second.cbegin();
try {
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode id of image '%s'", it->first.c_str());
return -EIO;
}
auto iter = in->cbegin();
decode(name, iter);
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(name, iter);
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(directory_state, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(directory_state, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = bl.cbegin();
decode(object_map, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode object map: %s", err.what());
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(object_map, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(object_count, iter);
decode(default_state, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
decode(end_object_no, iter);
decode(new_object_state, iter);
decode(current_object_state, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode message");
return -EINVAL;
}
try {
auto it = header_bl.cbegin();
object_map.decode_header(it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode object map header: %s", err.what());
return -EINVAL;
}
try {
auto it = footer_bl.cbegin();
object_map.decode_header_crc(it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode object map header CRC: %s", err.what());
}
try {
auto it = footer_bl.cbegin();
object_map.decode_data_crcs(it, start_object_no);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode object map data CRCs: %s", err.what());
}
try {
auto it = data_bl.cbegin();
object_map.decode_data(it, data_byte_offset);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("failed to decode data chunk [%" PRIu64 "]: %s",
data_byte_offset, err.what());
return -EINVAL;
try {
auto iter = in->cbegin();
decode(src_object_map, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(data, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
- for (map<string, bufferlist>::iterator it = data.begin();
- it != data.end(); ++it) {
+ for (auto it = data.begin(); it != data.end(); ++it) {
CLS_LOG(20, "metadata_set key=%s value=%.*s", it->first.c_str(),
it->second.length(), it->second.c_str());
raw_data[metadata_key_for_name(it->first)].swap(it->second);
auto iter = in->cbegin();
try {
decode(key, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(key, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(new_limit, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(snap_id, it);
decode(child_image, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(snap_id, it);
decode(child_image, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(snap_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(migration_spec, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(state, it);
decode(description, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(snapc_seq, it);
decode(state, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
decode(s, iter);
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
snap_name = s.c_str();
try {
decode(s, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
snap_name = s.c_str();
try {
decode(src_snap_id, iter);
decode(dst, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
dst_snap_name = dst.c_str();
cls::rbd::MirrorPeer peer;
decode(peer, bl_it);
peers->push_back(peer);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode peer '%s'", it.first.c_str());
return -EIO;
}
try {
auto bl_it = bl.cbegin();
decode(*peer, bl_it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode peer '%s'", id.c_str());
return -EIO;
}
try {
auto it = bl.cbegin();
decode(*mirror_image, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode mirrored image '%s'", image_id.c_str());
return -EIO;
}
try {
auto it = bl.cbegin();
decode(ondisk_status, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode status for mirrored image, global id '%s', "
"site '%s'",
global_image_id.c_str(), mirror_uuid.c_str());
auto iter = it->second.cbegin();
try {
decode(mirror_image, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode mirror image payload of image '%s'",
image_id.c_str());
return -EIO;
auto iter = list_it.second.cbegin();
try {
decode(mirror_image, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode mirror image payload for key '%s'",
key.c_str());
return -EIO;
try {
auto it = list_it.second.cbegin();
status.decode_meta(it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode status metadata for mirrored image '%s'",
key.c_str());
return -EIO;
try {
auto it = bl.cbegin();
decode(ondisk_status, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode status for mirrored image, global id '%s'",
global_image_id.c_str());
return -EIO;
auto iter = it->second.cbegin();
try {
decode(mirror_image, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode mirror image payload of image '%s'",
image_id.c_str());
return -EIO;
auto iter = it->second.cbegin();
try {
decode(mirror_image_map, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode image map payload: %s",
cpp_strerror(r).c_str());
return -EINVAL;
try {
auto bl_it = in->cbegin();
decode(mirror_uuid, bl_it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto bl_it = in->cbegin();
decode(mirror_mode_decode, bl_it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
decode(direction, it);
mirror_peer_direction = static_cast<cls::rbd::MirrorPeerDirection>(
direction);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(mirror_peer, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(uuid, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(uuid, it);
decode(client_name, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(uuid, it);
decode(site_name, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
decode(direction, it);
mirror_peer_direction = static_cast<cls::rbd::MirrorPeerDirection>(
direction);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = it->second.cbegin();
try {
decode(mirror_image, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode mirror image payload of image '%s'",
image_id.c_str());
return -EIO;
try {
auto it = in->cbegin();
decode(global_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(image_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(image_id, it);
decode(mirror_image, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(image_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(global_image_id, it);
decode(status, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(global_image_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(global_image_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
if (!iter.end()) {
decode(peers, iter);
}
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(global_image_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(instance_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(instance_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(start_after, it);
decode(max_return, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto it = in->cbegin();
decode(global_image_id, it);
decode(image_map, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto it = in->cbegin();
decode(global_image_id, it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(snap_id, iter);
decode(mirror_peer_uuid, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
decode(snap_id, iter);
decode(complete, iter);
decode(last_copied_object_number, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
if (r < 0)
return r;
- for (map<string, bufferlist>::iterator it = vals.begin();
- it != vals.end() && group_snaps->size() < max_return; ++it) {
+ for (auto it = vals.begin(); it != vals.end() && group_snaps->size() < max_return; ++it) {
auto iter = it->second.cbegin();
cls::rbd::GroupSnapshot snap;
try {
decode(snap, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding snapshot: %s", it->first.c_str());
return -EIO;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
return r;
}
- for (pair<string, bufferlist> val: vals) {
+ for (auto val : vals) {
string id;
auto iter = val.second.cbegin();
try {
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("could not decode id of group '%s'", val.first.c_str());
return -EIO;
}
auto iter = in->cbegin();
decode(name, iter);
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
decode(src, iter);
decode(dest, iter);
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(name, iter);
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(st, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(spec, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
if (r < 0)
return r;
- for (map<string, bufferlist>::iterator it = vals.begin();
- it != vals.end() && res.size() < max_return; ++it) {
+ for (auto it = vals.begin(); it != vals.end() && res.size() < max_return; ++it) {
auto iter = it->second.cbegin();
cls::rbd::GroupImageLinkState state;
try {
decode(state, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding state for image: %s", it->first.c_str());
return -EIO;
}
try {
auto iter = in->cbegin();
decode(new_group, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = existing_refbl.cbegin();
decode(old_group, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(spec, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = refbl.cbegin();
try {
decode(ref_spec, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = refbl.cbegin();
try {
decode(spec, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
}
try {
auto iter = in->cbegin();
decode(group_snap, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(snap_id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = snapbl.cbegin();
try {
decode(group_snap, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
CLS_ERR("error decoding snapshot: %s", snap_id.c_str());
return -EIO;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
std::vector<cls::rbd::GroupSnapshot> group_snaps;
auto iter = in->cbegin();
decode(id, iter);
decode(trash_spec, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
break;
}
- map<string, bufferlist>::iterator it = raw_data.begin();
- for (; it != raw_data.end(); ++it) {
+ for (auto it = raw_data.begin(); it != raw_data.end(); ++it) {
decode(data[trash::image_id_from_key(it->first)], it->second);
}
try {
auto iter = in->cbegin();
decode(id, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
cls::rbd::TrashImageState trash_state;
cls::rbd::TrashImageState expect_state;
try {
- bufferlist::const_iterator iter = in->begin();
+ auto iter = in->cbegin();
decode(id, iter);
decode(trash_state, iter);
decode(expect_state, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(name, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
try {
auto iter = in->cbegin();
decode(name, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(start_after, iter);
decode(max_return, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
auto iter = in->cbegin();
decode(sparse_size, iter);
decode(remove_empty, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EINVAL;
}
return 0;
}
- bl.rebuild(buffer::ptr_node::create(bl.length()));
+ bl.rebuild(ceph::buffer::ptr_node::create(bl.length()));
size_t write_offset = 0;
size_t write_length = 0;
size_t offset = 0;
CLS_LOG(20, "write%s %" PRIu64 "~%" PRIu64, (replace ? "(replace)" : ""),
write_offset, write_length);
bufferlist write_bl;
- write_bl.push_back(buffer::ptr_node::create(ptr, write_offset,
- write_length));
+ write_bl.push_back(ceph::buffer::ptr_node::create(ptr, write_offset,
+ write_length));
if (replace) {
- r = cls_cxx_replace(hctx, write_offset, write_length, &write_bl);
+ r = cls_cxx_replace(hctx, write_offset, write_length, &write_bl);
replace = false;
} else {
r = cls_cxx_write(hctx, write_offset, write_length, &write_bl);
return !(*this == rhs);
}
- void encode(bufferlist& bl, uint64_t features) const {
+ void encode(ceph::buffer::list& bl, uint64_t features) const {
// NOTE: remove support for version 1 after Nautilus EOLed
uint8_t version = 1;
if ((features & CEPH_FEATURE_SERVER_NAUTILUS) != 0ULL) {
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(pool_id, bl);
if (struct_v >= 2) {
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_int("pool_id", pool_id);
f->dump_string("pool_namespace", pool_namespace);
f->dump_string("image_id", image_id);
}
}
- static void generate_test_instances(list<cls_rbd_parent*>& o) {
+ static void generate_test_instances(std::list<cls_rbd_parent*>& o) {
o.push_back(new cls_rbd_parent{});
o.push_back(new cls_rbd_parent{{1, "", "image id", 234}, {}});
o.push_back(new cls_rbd_parent{{1, "", "image id", 234}, {123}});
(parent.exists()));
}
- void encode(bufferlist& bl, uint64_t features) const {
+ void encode(ceph::buffer::list& bl, uint64_t features) const {
// NOTE: remove support for versions < 8 after Nautilus EOLed
uint8_t min_version = 1;
if ((features & CEPH_FEATURE_SERVER_NAUTILUS) != 0ULL) {
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& p) {
+ void decode(ceph::buffer::list::const_iterator& p) {
DECODE_START(8, p);
decode(id, p);
decode(name, p);
DECODE_FINISH(p);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_unsigned("id", id);
f->dump_string("name", name);
f->dump_unsigned("image_size", image_size);
}
}
- static void generate_test_instances(list<cls_rbd_snap*>& o) {
+ static void generate_test_instances(std::list<cls_rbd_snap*>& o) {
o.push_back(new cls_rbd_snap{});
o.push_back(new cls_rbd_snap{1, "snap", 123456,
RBD_PROTECTION_STATUS_PROTECTED,
namespace librbd {
namespace cls_client {
+using std::map;
+using std::set;
+using std::string;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+
void create_image(librados::ObjectWriteOperation *op, uint64_t size,
uint8_t order, uint64_t features,
const std::string &object_prefix, int64_t data_pool_id)
try {
decode(*features, *it);
decode(*incompatible_features, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
{
try {
decode(*object_prefix, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
int get_data_pool_finish(bufferlist::const_iterator *it, int64_t *data_pool_id) {
try {
decode(*data_pool_id, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
try {
decode(*order, *it);
decode(*size, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
int get_flags_finish(bufferlist::const_iterator *it, uint64_t *flags) {
try {
decode(*flags, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
{
try {
decode(*op_features, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
decode(pspec->image_id, *it);
decode(pspec->snap_id, *it);
decode(*parent_overlap, *it);
- } catch (const buffer::error &) {
+ } catch (const ceph::buffer::error &) {
return -EBADMSG;
}
return 0;
cls::rbd::ParentImageSpec* parent_image_spec) {
try {
decode(*parent_image_spec, *it);
- } catch (const buffer::error &) {
+ } catch (const ceph::buffer::error &) {
return -EBADMSG;
}
return 0;
std::optional<uint64_t>* parent_overlap) {
try {
decode(*parent_overlap, *it);
- } catch (const buffer::error &) {
+ } catch (const ceph::buffer::error &) {
return -EBADMSG;
}
return 0;
std::set<std::string>* children) {
try {
decode(*children, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
{
try {
decode(*snap_info, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
{
try {
decode(*snapc, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
if (!snapc->is_valid()) {
{
try {
decode(*name, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
{
try {
decode(*timestamp, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
decode((*sizes)[i], *it);
decode((*names)[i], *it);
}
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
uint64_t *all_features) {
try {
decode(*all_features, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
{
try {
decode(*protection_status, *it);
- } catch (const buffer::error &) {
+ } catch (const ceph::buffer::error &) {
return -EBADMSG;
}
return 0;
{
try {
decode(*limit, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
try {
decode(*stripe_unit, *it);
decode(*stripe_count, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
try {
decode(*timestamp, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
try {
decode(*timestamp, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
try {
decode(*timestamp, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
int get_id_finish(bufferlist::const_iterator *it, std::string *id) {
try {
decode(*id, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
int dir_get_id_finish(bufferlist::const_iterator *iter, std::string *image_id) {
try {
decode(*image_id, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
int dir_get_name_finish(bufferlist::const_iterator *it, std::string *name) {
try {
decode(*name, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
{
try {
decode(*images, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
ceph::BitVector<2> *object_map) {
try {
decode(*object_map, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
ceph_assert(pairs);
try {
decode(*pairs, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
std::string* value) {
try {
decode(*value, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
child_images->clear();
try {
decode(*child_images, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
cls::rbd::MigrationSpec *migration_spec) {
try {
decode(*migration_spec, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
std::string *uuid) {
try {
decode(*uuid, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
uint32_t mirror_mode_decode;
decode(mirror_mode_decode, *it);
*mirror_mode = static_cast<cls::rbd::MirrorMode>(mirror_mode_decode);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
peers->clear();
try {
decode(*peers, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
{
try {
decode(*mirror_image_ids, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
std::string *image_id) {
try {
decode(*image_id, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
cls::rbd::MirrorImage *mirror_image) {
try {
decode(*mirror_image, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
cls::rbd::MirrorImageStatus *status) {
try {
decode(*status, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
try {
decode(*images, *iter);
decode(*statuses, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
std::map<cls::rbd::MirrorImageStatusState, int32_t> *states) {
try {
decode(*states, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
entity_inst_t *instance) {
try {
decode(*instance, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
instances->clear();
try {
decode(*instances, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
instance_ids->clear();
try {
decode(*instance_ids, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
std::map<std::string, cls::rbd::MirrorImageMap> *image_mapping) {
try {
decode(*image_mapping, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
auto iter = out.cbegin();
try {
decode(*cgs, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
auto iter = bl2.cbegin();
try {
decode(*images, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
{
try {
decode(*group_spec, *iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
return 0;
auto iter = outbl.cbegin();
try {
decode(*snapshot, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
auto iter = outbl.cbegin();
try {
decode(*snapshots, iter);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
try {
decode(*entries, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
ceph_assert(trash_spec);
try {
decode(*trash_spec, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
try {
decode(*entries, *it);
- } catch (const buffer::error &err) {
+ } catch (const ceph::buffer::error &err) {
return -EBADMSG;
}
const std::string &object_prefix, int64_t data_pool_id);
void get_features_start(librados::ObjectReadOperation *op, bool read_only);
-int get_features_finish(bufferlist::const_iterator *it, uint64_t *features,
+int get_features_finish(ceph::buffer::list::const_iterator *it, uint64_t *features,
uint64_t *incompatible_features);
int get_features(librados::IoCtx *ioctx, const std::string &oid,
bool read_only, uint64_t *features,
uint64_t features, uint64_t mask);
void get_object_prefix_start(librados::ObjectReadOperation *op);
-int get_object_prefix_finish(bufferlist::const_iterator *it,
+int get_object_prefix_finish(ceph::buffer::list::const_iterator *it,
std::string *object_prefix);
int get_object_prefix(librados::IoCtx *ioctx, const std::string &oid,
std::string *object_prefix);
void get_data_pool_start(librados::ObjectReadOperation *op);
-int get_data_pool_finish(bufferlist::const_iterator *it, int64_t *data_pool_id);
+int get_data_pool_finish(ceph::buffer::list::const_iterator *it, int64_t *data_pool_id);
int get_data_pool(librados::IoCtx *ioctx, const std::string &oid,
int64_t *data_pool_id);
void get_size_start(librados::ObjectReadOperation *op, snapid_t snap_id);
-int get_size_finish(bufferlist::const_iterator *it, uint64_t *size,
+int get_size_finish(ceph::buffer::list::const_iterator *it, uint64_t *size,
uint8_t *order);
int get_size(librados::IoCtx *ioctx, const std::string &oid,
snapid_t snap_id, uint64_t *size, uint8_t *order);
void set_size(librados::ObjectWriteOperation *op, uint64_t size);
void get_flags_start(librados::ObjectReadOperation *op, snapid_t snap_id);
-int get_flags_finish(bufferlist::const_iterator *it, uint64_t *flags);
+int get_flags_finish(ceph::buffer::list::const_iterator *it, uint64_t *flags);
int get_flags(librados::IoCtx *ioctx, const std::string &oid,
snapid_t snap_id, uint64_t *flags);
uint64_t flags, uint64_t mask);
void op_features_get_start(librados::ObjectReadOperation *op);
-int op_features_get_finish(bufferlist::const_iterator *it,
+int op_features_get_finish(ceph::buffer::list::const_iterator *it,
uint64_t *op_features);
int op_features_get(librados::IoCtx *ioctx, const std::string &oid,
uint64_t *op_features);
// NOTE: deprecate v1 parent APIs after mimic EOLed
void get_parent_start(librados::ObjectReadOperation *op, snapid_t snap_id);
-int get_parent_finish(bufferlist::const_iterator *it,
+int get_parent_finish(ceph::buffer::list::const_iterator *it,
cls::rbd::ParentImageSpec *pspec,
uint64_t *parent_overlap);
int get_parent(librados::IoCtx *ioctx, const std::string &oid,
// v2 parent APIs
void parent_get_start(librados::ObjectReadOperation* op);
-int parent_get_finish(bufferlist::const_iterator* it,
+int parent_get_finish(ceph::buffer::list::const_iterator* it,
cls::rbd::ParentImageSpec* parent_image_spec);
int parent_get(librados::IoCtx* ioctx, const std::string &oid,
cls::rbd::ParentImageSpec* parent_image_spec);
void parent_overlap_get_start(librados::ObjectReadOperation* op,
snapid_t snap_id);
-int parent_overlap_get_finish(bufferlist::const_iterator* it,
+int parent_overlap_get_finish(ceph::buffer::list::const_iterator* it,
std::optional<uint64_t>* parent_overlap);
int parent_overlap_get(librados::IoCtx* ioctx, const std::string &oid,
snapid_t snap_id,
const std::string &c_imageid);
void get_children_start(librados::ObjectReadOperation *op,
const cls::rbd::ParentImageSpec &pspec);
-int get_children_finish(bufferlist::const_iterator *it,
- std::set<string> *children);
+int get_children_finish(ceph::buffer::list::const_iterator *it,
+ std::set<std::string> *children);
int get_children(librados::IoCtx *ioctx, const std::string &oid,
- const cls::rbd::ParentImageSpec& pspec, set<string>& children);
+ const cls::rbd::ParentImageSpec& pspec, std::set<std::string>& children);
void snapshot_get_start(librados::ObjectReadOperation* op,
snapid_t snap_id);
-int snapshot_get_finish(bufferlist::const_iterator* it,
+int snapshot_get_finish(ceph::buffer::list::const_iterator* it,
cls::rbd::SnapshotInfo* snap_info);
int snapshot_get(librados::IoCtx *ioctx, const std::string &oid,
snapid_t snap_id, cls::rbd::SnapshotInfo* snap_info);
snapid_t snap_id);
void get_snapcontext_start(librados::ObjectReadOperation *op);
-int get_snapcontext_finish(bufferlist::const_iterator *it,
+int get_snapcontext_finish(ceph::buffer::list::const_iterator *it,
::SnapContext *snapc);
int get_snapcontext(librados::IoCtx *ioctx, const std::string &oid,
::SnapContext *snapc);
/// NOTE: remove after Luminous is retired
void get_snapshot_name_start(librados::ObjectReadOperation *op,
snapid_t snap_id);
-int get_snapshot_name_finish(bufferlist::const_iterator *it,
+int get_snapshot_name_finish(ceph::buffer::list::const_iterator *it,
std::string *name);
int get_snapshot_name(librados::IoCtx *ioctx, const std::string &oid,
snapid_t snap_id, std::string *name);
/// NOTE: remove after Luminous is retired
void get_snapshot_timestamp_start(librados::ObjectReadOperation *op,
snapid_t snap_id);
-int get_snapshot_timestamp_finish(bufferlist::const_iterator *it,
+int get_snapshot_timestamp_finish(ceph::buffer::list::const_iterator *it,
utime_t *timestamp);
int get_snapshot_timestamp(librados::IoCtx *ioctx, const std::string &oid,
snapid_t snap_id, utime_t *timestamp);
void get_all_features_start(librados::ObjectReadOperation *op);
-int get_all_features_finish(bufferlist::const_iterator *it,
+int get_all_features_finish(ceph::buffer::list::const_iterator *it,
uint64_t *all_features);
int get_all_features(librados::IoCtx *ioctx, const std::string &oid,
uint64_t *all_features);
/// NOTE: remove protection after clone v1 is retired
void get_protection_status_start(librados::ObjectReadOperation *op,
snapid_t snap_id);
-int get_protection_status_finish(bufferlist::const_iterator *it,
+int get_protection_status_finish(ceph::buffer::list::const_iterator *it,
uint8_t *protection_status);
int get_protection_status(librados::IoCtx *ioctx, const std::string &oid,
snapid_t snap_id, uint8_t *protection_status);
snapid_t snap_id, uint8_t protection_status);
void snapshot_get_limit_start(librados::ObjectReadOperation *op);
-int snapshot_get_limit_finish(bufferlist::const_iterator *it, uint64_t *limit);
+int snapshot_get_limit_finish(ceph::buffer::list::const_iterator *it, uint64_t *limit);
int snapshot_get_limit(librados::IoCtx *ioctx, const std::string &oid,
uint64_t *limit);
void snapshot_set_limit(librados::ObjectWriteOperation *op,
uint64_t limit);
void get_stripe_unit_count_start(librados::ObjectReadOperation *op);
-int get_stripe_unit_count_finish(bufferlist::const_iterator *it,
+int get_stripe_unit_count_finish(ceph::buffer::list::const_iterator *it,
uint64_t *stripe_unit,
uint64_t *stripe_count);
int get_stripe_unit_count(librados::IoCtx *ioctx, const std::string &oid,
uint64_t stripe_unit, uint64_t stripe_count);
void get_create_timestamp_start(librados::ObjectReadOperation *op);
-int get_create_timestamp_finish(bufferlist::const_iterator *it,
+int get_create_timestamp_finish(ceph::buffer::list::const_iterator *it,
utime_t *timestamp);
int get_create_timestamp(librados::IoCtx *ioctx, const std::string &oid,
utime_t *timestamp);
void get_access_timestamp_start(librados::ObjectReadOperation *op);
-int get_access_timestamp_finish(bufferlist::const_iterator *it,
+int get_access_timestamp_finish(ceph::buffer::list::const_iterator *it,
utime_t *timestamp);
int get_access_timestamp(librados::IoCtx *ioctx, const std::string &oid,
utime_t *timestamp);
int set_access_timestamp(librados::IoCtx *ioctx, const std::string &oid);
void get_modify_timestamp_start(librados::ObjectReadOperation *op);
-int get_modify_timestamp_finish(bufferlist::const_iterator *it,
+int get_modify_timestamp_finish(ceph::buffer::list::const_iterator *it,
utime_t *timestamp);
int get_modify_timestamp(librados::IoCtx *ioctx, const std::string &oid,
utime_t *timestamp);
int metadata_list(librados::IoCtx *ioctx, const std::string &oid,
const std::string &start, uint64_t max_return,
- map<string, bufferlist> *pairs);
+ std::map<std::string, ceph::buffer::list> *pairs);
void metadata_list_start(librados::ObjectReadOperation *op,
const std::string &start, uint64_t max_return);
-int metadata_list_finish(bufferlist::const_iterator *it,
- std::map<std::string, bufferlist> *pairs);
+int metadata_list_finish(ceph::buffer::list::const_iterator *it,
+ std::map<std::string, ceph::buffer::list> *pairs);
void metadata_set(librados::ObjectWriteOperation *op,
- const map<std::string, bufferlist> &data);
+ const std::map<std::string, ceph::buffer::list> &data);
int metadata_set(librados::IoCtx *ioctx, const std::string &oid,
- const map<std::string, bufferlist> &data);
+ const std::map<std::string, ceph::buffer::list> &data);
void metadata_remove(librados::ObjectWriteOperation *op,
const std::string &key);
int metadata_remove(librados::IoCtx *ioctx, const std::string &oid,
const std::string &key);
void metadata_get_start(librados::ObjectReadOperation* op,
const std::string &key);
-int metadata_get_finish(bufferlist::const_iterator *it,
+int metadata_get_finish(ceph::buffer::list::const_iterator *it,
std::string* value);
int metadata_get(librados::IoCtx *ioctx, const std::string &oid,
- const std::string &key, string *v);
+ const std::string &key, std::string *v);
void child_attach(librados::ObjectWriteOperation *op, snapid_t snap_id,
const cls::rbd::ChildImageSpec& child_image);
const cls::rbd::ChildImageSpec& child_image);
void children_list_start(librados::ObjectReadOperation *op,
snapid_t snap_id);
-int children_list_finish(bufferlist::const_iterator *it,
+int children_list_finish(ceph::buffer::list::const_iterator *it,
cls::rbd::ChildImageSpecs *child_images);
int children_list(librados::IoCtx *ioctx, const std::string &oid,
snapid_t snap_id,
cls::rbd::MigrationState state,
const std::string &description);
void migration_get_start(librados::ObjectReadOperation *op);
-int migration_get_finish(bufferlist::const_iterator *it,
+int migration_get_finish(ceph::buffer::list::const_iterator *it,
cls::rbd::MigrationSpec *migration_spec);
int migration_get(librados::IoCtx *ioctx, const std::string &oid,
cls::rbd::MigrationSpec *migration_spec);
// operations on rbd_id objects
void get_id_start(librados::ObjectReadOperation *op);
-int get_id_finish(bufferlist::const_iterator *it, std::string *id);
+int get_id_finish(ceph::buffer::list::const_iterator *it, std::string *id);
int get_id(librados::IoCtx *ioctx, const std::string &oid, std::string *id);
void set_id(librados::ObjectWriteOperation *op, const std::string &id);
const std::string &name, std::string *id);
void dir_get_id_start(librados::ObjectReadOperation *op,
const std::string &image_name);
-int dir_get_id_finish(bufferlist::const_iterator *iter, std::string *image_id);
+int dir_get_id_finish(ceph::buffer::list::const_iterator *iter, std::string *image_id);
void dir_get_name_start(librados::ObjectReadOperation *op,
const std::string &id);
-int dir_get_name_finish(bufferlist::const_iterator *it, std::string *name);
+int dir_get_name_finish(ceph::buffer::list::const_iterator *it, std::string *name);
int dir_get_name(librados::IoCtx *ioctx, const std::string &oid,
const std::string &id, std::string *name);
void dir_list_start(librados::ObjectReadOperation *op,
const std::string &start, uint64_t max_return);
-int dir_list_finish(bufferlist::const_iterator *it, map<string, string> *images);
+int dir_list_finish(ceph::buffer::list::const_iterator *it, std::map<std::string, std::string> *images);
int dir_list(librados::IoCtx *ioctx, const std::string &oid,
const std::string &start, uint64_t max_return,
- map<string, string> *images);
+ std::map<std::string, std::string> *images);
void dir_add_image(librados::ObjectWriteOperation *op,
const std::string &name, const std::string &id);
int dir_add_image(librados::IoCtx *ioctx, const std::string &oid,
// operations on the rbd_object_map.$image_id object
void object_map_load_start(librados::ObjectReadOperation *op);
-int object_map_load_finish(bufferlist::const_iterator *it,
+int object_map_load_finish(ceph::buffer::list::const_iterator *it,
ceph::BitVector<2> *object_map);
int object_map_load(librados::IoCtx *ioctx, const std::string &oid,
ceph::BitVector<2> *object_map);
snapid_t src_snap_id, const std::string &dst_name);
void old_snapshot_list_start(librados::ObjectReadOperation *op);
-int old_snapshot_list_finish(bufferlist::const_iterator *it,
- std::vector<string> *names,
+int old_snapshot_list_finish(ceph::buffer::list::const_iterator *it,
+ std::vector<std::string> *names,
std::vector<uint64_t> *sizes,
::SnapContext *snapc);
int old_snapshot_list(librados::IoCtx *ioctx, const std::string &oid,
- std::vector<string> *names,
+ std::vector<std::string> *names,
std::vector<uint64_t> *sizes,
::SnapContext *snapc);
// operations on the rbd_mirroring object
void mirror_uuid_get_start(librados::ObjectReadOperation *op);
-int mirror_uuid_get_finish(bufferlist::const_iterator *it,
+int mirror_uuid_get_finish(ceph::buffer::list::const_iterator *it,
std::string *uuid);
int mirror_uuid_get(librados::IoCtx *ioctx, std::string *uuid);
int mirror_uuid_set(librados::IoCtx *ioctx, const std::string &uuid);
void mirror_mode_get_start(librados::ObjectReadOperation *op);
-int mirror_mode_get_finish(bufferlist::const_iterator *it,
+int mirror_mode_get_finish(ceph::buffer::list::const_iterator *it,
cls::rbd::MirrorMode *mirror_mode);
int mirror_mode_get(librados::IoCtx *ioctx,
cls::rbd::MirrorMode *mirror_mode);
const std::string& site_name,
const std::string& fsid);
void mirror_peer_list_start(librados::ObjectReadOperation *op);
-int mirror_peer_list_finish(bufferlist::const_iterator *it,
+int mirror_peer_list_finish(ceph::buffer::list::const_iterator *it,
std::vector<cls::rbd::MirrorPeer> *peers);
int mirror_peer_list(librados::IoCtx *ioctx,
std::vector<cls::rbd::MirrorPeer> *peers);
void mirror_image_list_start(librados::ObjectReadOperation *op,
const std::string &start, uint64_t max_return);
-int mirror_image_list_finish(bufferlist::const_iterator *it,
- std::map<string, string> *mirror_image_ids);
+int mirror_image_list_finish(ceph::buffer::list::const_iterator *it,
+ std::map<std::string, std::string> *mirror_image_ids);
int mirror_image_list(librados::IoCtx *ioctx,
const std::string &start, uint64_t max_return,
std::map<std::string, std::string> *mirror_image_ids);
void mirror_image_get_image_id_start(librados::ObjectReadOperation *op,
const std::string &global_image_id);
-int mirror_image_get_image_id_finish(bufferlist::const_iterator *it,
+int mirror_image_get_image_id_finish(ceph::buffer::list::const_iterator *it,
std::string *image_id);
int mirror_image_get_image_id(librados::IoCtx *ioctx,
const std::string &global_image_id,
cls::rbd::MirrorImage *mirror_image);
void mirror_image_get_start(librados::ObjectReadOperation *op,
const std::string &image_id);
-int mirror_image_get_finish(bufferlist::const_iterator *iter,
+int mirror_image_get_finish(ceph::buffer::list::const_iterator *iter,
cls::rbd::MirrorImage *mirror_image);
void mirror_image_set(librados::ObjectWriteOperation *op,
const std::string &image_id,
cls::rbd::MirrorImageStatus *status);
void mirror_image_status_get_start(librados::ObjectReadOperation *op,
const std::string &global_image_id);
-int mirror_image_status_get_finish(bufferlist::const_iterator *iter,
+int mirror_image_status_get_finish(ceph::buffer::list::const_iterator *iter,
cls::rbd::MirrorImageStatus *status);
int mirror_image_status_list(librados::IoCtx *ioctx,
const std::string &start, uint64_t max_return,
void mirror_image_status_list_start(librados::ObjectReadOperation *op,
const std::string &start,
uint64_t max_return);
-int mirror_image_status_list_finish(bufferlist::const_iterator *iter,
+int mirror_image_status_list_finish(ceph::buffer::list::const_iterator *iter,
std::map<std::string, cls::rbd::MirrorImage> *images,
std::map<std::string, cls::rbd::MirrorImageStatus> *statuses);
int mirror_image_status_get_summary(
librados::ObjectReadOperation *op,
const std::vector<cls::rbd::MirrorPeer>& mirror_peer_sites);
int mirror_image_status_get_summary_finish(
- bufferlist::const_iterator *iter,
+ ceph::buffer::list::const_iterator *iter,
std::map<cls::rbd::MirrorImageStatusState, int32_t> *states);
int mirror_image_status_remove_down(librados::IoCtx *ioctx);
void mirror_image_status_remove_down(librados::ObjectWriteOperation *op);
entity_inst_t *instance);
void mirror_image_instance_get_start(librados::ObjectReadOperation *op,
const std::string &global_image_id);
-int mirror_image_instance_get_finish(bufferlist::const_iterator *iter,
+int mirror_image_instance_get_finish(ceph::buffer::list::const_iterator *iter,
entity_inst_t *instance);
int mirror_image_instance_list(librados::IoCtx *ioctx,
const std::string &start, uint64_t max_return,
void mirror_image_instance_list_start(librados::ObjectReadOperation *op,
const std::string &start,
uint64_t max_return);
-int mirror_image_instance_list_finish(bufferlist::const_iterator *iter,
+int mirror_image_instance_list_finish(ceph::buffer::list::const_iterator *iter,
std::map<std::string, entity_inst_t> *instances);
void mirror_instances_list_start(librados::ObjectReadOperation *op);
-int mirror_instances_list_finish(bufferlist::const_iterator *iter,
+int mirror_instances_list_finish(ceph::buffer::list::const_iterator *iter,
std::vector<std::string> *instance_ids);
int mirror_instances_list(librados::IoCtx *ioctx,
std::vector<std::string> *instance_ids);
void mirror_image_map_list_start(librados::ObjectReadOperation *op,
const std::string &start_after,
uint64_t max_read);
-int mirror_image_map_list_finish(bufferlist::const_iterator *iter,
+int mirror_image_map_list_finish(ceph::buffer::list::const_iterator *iter,
std::map<std::string, cls::rbd::MirrorImageMap> *image_mapping);
int mirror_image_map_list(librados::IoCtx *ioctx,
const std::string &start_after, uint64_t max_read,
// Groups functions
int group_dir_list(librados::IoCtx *ioctx, const std::string &oid,
const std::string &start, uint64_t max_return,
- map<string, string> *groups);
+ std::map<std::string, std::string> *groups);
int group_dir_add(librados::IoCtx *ioctx, const std::string &oid,
const std::string &name, const std::string &id);
int group_dir_rename(librados::IoCtx *ioctx, const std::string &oid,
int image_group_remove(librados::IoCtx *ioctx, const std::string &oid,
const cls::rbd::GroupSpec &group_spec);
void image_group_get_start(librados::ObjectReadOperation *op);
-int image_group_get_finish(bufferlist::const_iterator *iter,
+int image_group_get_finish(ceph::buffer::list::const_iterator *iter,
cls::rbd::GroupSpec *group_spec);
int image_group_get(librados::IoCtx *ioctx, const std::string &oid,
cls::rbd::GroupSpec *group_spec);
int trash_remove(librados::IoCtx *ioctx, const std::string &id);
void trash_list_start(librados::ObjectReadOperation *op,
const std::string &start, uint64_t max_return);
-int trash_list_finish(bufferlist::const_iterator *it,
- map<string, cls::rbd::TrashImageSpec> *entries);
+int trash_list_finish(ceph::buffer::list::const_iterator *it,
+ std::map<std::string, cls::rbd::TrashImageSpec> *entries);
int trash_list(librados::IoCtx *ioctx,
const std::string &start, uint64_t max_return,
- map<string, cls::rbd::TrashImageSpec> *entries);
+ std::map<std::string, cls::rbd::TrashImageSpec> *entries);
void trash_get_start(librados::ObjectReadOperation *op,
const std::string &id);
-int trash_get_finish(bufferlist::const_iterator *it,
+int trash_get_finish(ceph::buffer::list::const_iterator *it,
cls::rbd::TrashImageSpec *trash_spec);
int trash_get(librados::IoCtx *ioctx, const std::string &id,
cls::rbd::TrashImageSpec *trash_spec);
int namespace_remove(librados::IoCtx *ioctx, const std::string &name);
void namespace_list_start(librados::ObjectReadOperation *op,
const std::string &start, uint64_t max_return);
-int namespace_list_finish(bufferlist::const_iterator *it,
+int namespace_list_finish(ceph::buffer::list::const_iterator *it,
std::list<std::string> *entries);
int namespace_list(librados::IoCtx *ioctx,
const std::string &start, uint64_t max_return,
uint64_t snapc_seq,
cls::rbd::AssertSnapcSeqState state);
-void copyup(librados::ObjectWriteOperation *op, bufferlist data);
+void copyup(librados::ObjectWriteOperation *op, ceph::buffer::list data);
int copyup(librados::IoCtx *ioctx, const std::string &oid,
- bufferlist data);
+ ceph::buffer::list data);
void sparse_copyup(librados::ObjectWriteOperation *op,
const std::map<uint64_t, uint64_t> &extent_map,
- bufferlist data);
+ ceph::buffer::list data);
int sparse_copyup(librados::IoCtx *ioctx, const std::string &oid,
const std::map<uint64_t, uint64_t> &extent_map,
- bufferlist data);
+ ceph::buffer::list data);
void sparsify(librados::ObjectWriteOperation *op, size_t sparse_size,
bool remove_empty);
namespace cls {
namespace rbd {
+using std::istringstream;
+using std::ostringstream;
+using std::string;
+
+using ceph::bufferlist;
+using ceph::Formatter;
+
std::ostream& operator<<(std::ostream& os,
MirrorPeerDirection mirror_peer_direction) {
switch (mirror_peer_direction) {
namespace rbd {
static const uint32_t MAX_OBJECT_MAP_OBJECT_COUNT = 256000000;
-static const string RBD_GROUP_IMAGE_KEY_PREFIX = "image_";
+static const std::string RBD_GROUP_IMAGE_KEY_PREFIX = "image_";
enum DirectoryState {
DIRECTORY_STATE_READY = 0,
DIRECTORY_STATE_ADD_DISABLED = 1
};
-inline void encode(DirectoryState state, bufferlist& bl,
+inline void encode(DirectoryState state, ceph::buffer::list& bl,
uint64_t features=0)
{
ceph::encode(static_cast<uint8_t>(state), bl);
}
-inline void decode(DirectoryState &state, bufferlist::const_iterator& it)
+inline void decode(DirectoryState &state, ceph::buffer::list::const_iterator& it)
{
uint8_t int_state;
ceph::decode(int_state, it);
GROUP_IMAGE_LINK_STATE_INCOMPLETE
};
-inline void encode(const GroupImageLinkState &state, bufferlist& bl,
+inline void encode(const GroupImageLinkState &state, ceph::buffer::list& bl,
uint64_t features=0)
{
using ceph::encode;
encode(static_cast<uint8_t>(state), bl);
}
-inline void decode(GroupImageLinkState &state, bufferlist::const_iterator& it)
+inline void decode(GroupImageLinkState &state, ceph::buffer::list::const_iterator& it)
{
uint8_t int_state;
using ceph::decode;
return (!uuid.empty() && !site_name.empty());
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<MirrorPeer*> &o);
std::string global_image_id;
MirrorImageState state = MIRROR_IMAGE_STATE_DISABLING;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<MirrorImage*> &o);
MIRROR_IMAGE_STATUS_STATE_STOPPED = 6,
};
-inline void encode(const MirrorImageStatusState &state, bufferlist& bl,
+inline void encode(const MirrorImageStatusState &state, ceph::buffer::list& bl,
uint64_t features=0)
{
using ceph::encode;
}
inline void decode(MirrorImageStatusState &state,
- bufferlist::const_iterator& it)
+ ceph::buffer::list::const_iterator& it)
{
uint8_t int_state;
using ceph::decode;
utime_t last_update;
bool up = false;
- void encode_meta(uint8_t version, bufferlist &bl) const;
- void decode_meta(uint8_t version, bufferlist::const_iterator &it);
+ void encode_meta(uint8_t version, ceph::buffer::list &bl) const;
+ void decode_meta(uint8_t version, ceph::buffer::list::const_iterator &it);
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
std::string state_to_string() const;
cls::rbd::MirrorImageSiteStatus(status) {
}
- void encode_meta(bufferlist &bl, uint64_t features) const;
- void decode_meta(bufferlist::const_iterator &it);
+ void encode_meta(ceph::buffer::list &bl, uint64_t features) const;
+ void decode_meta(ceph::buffer::list::const_iterator &it);
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &it);
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &it);
static void generate_test_instances(
std::list<MirrorImageSiteStatusOnDisk*> &o);
int get_local_mirror_image_site_status(MirrorImageSiteStatus* status) const;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
bool operator==(const MirrorImageStatus& rhs) const;
return !(*this == rhs);
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<ParentImageSpec*> &o);
};
: pool_id(pool_id), pool_namespace(pool_namespace), image_id(image_id) {
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<ChildImageSpec*> &o);
std::string image_id;
int64_t pool_id = -1;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<GroupImageSpec*> &o);
GroupImageSpec spec;
GroupImageLinkState state = GROUP_IMAGE_LINK_STATE_INCOMPLETE;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<GroupImageStatus*> &o);
std::string group_id;
int64_t pool_id = -1;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
bool is_valid() const;
static void generate_test_instances(std::list<GroupSpec *> &o);
UserSnapshotNamespace() {}
- void encode(bufferlist& bl) const {}
- void decode(bufferlist::const_iterator& it) {}
+ void encode(ceph::buffer::list& bl) const {}
+ void decode(ceph::buffer::list::const_iterator& it) {}
- void dump(Formatter *f) const {}
+ void dump(ceph::Formatter *f) const {}
inline bool operator==(const UserSnapshotNamespace& usn) const {
return true;
GroupSnapshotNamespace() {}
GroupSnapshotNamespace(int64_t _group_pool,
- const string &_group_id,
- const string &_group_snapshot_id)
+ const std::string &_group_id,
+ const std::string &_group_snapshot_id)
: group_id(_group_id), group_pool(_group_pool),
group_snapshot_id(_group_snapshot_id) {}
- string group_id;
+ std::string group_id;
int64_t group_pool = 0;
- string group_snapshot_id;
+ std::string group_snapshot_id;
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& it);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
inline bool operator==(const GroupSnapshotNamespace& gsn) const {
return group_pool == gsn.group_pool &&
: original_name(original_name),
original_snapshot_namespace_type(original_snapshot_namespace_type) {}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
+ void dump(ceph::Formatter *f) const;
inline bool operator==(const TrashSnapshotNamespace& usn) const {
return true;
MIRROR_SNAPSHOT_STATE_NON_PRIMARY_DEMOTED = 3,
};
-inline void encode(const MirrorSnapshotState &state, bufferlist& bl,
+inline void encode(const MirrorSnapshotState &state, ceph::buffer::list& bl,
uint64_t features=0) {
using ceph::encode;
encode(static_cast<uint8_t>(state), bl);
}
-inline void decode(MirrorSnapshotState &state, bufferlist::const_iterator& it) {
+inline void decode(MirrorSnapshotState &state, ceph::buffer::list::const_iterator& it) {
using ceph::decode;
uint8_t int_state;
decode(int_state, it);
primary_snap_id == CEPH_NOSNAP);
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& it);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
inline bool operator==(const MirrorSnapshotNamespace& rhs) const {
return state == rhs.state &&
UnknownSnapshotNamespace() {}
- void encode(bufferlist& bl) const {}
- void decode(bufferlist::const_iterator& it) {}
- void dump(Formatter *f) const {}
+ void encode(ceph::buffer::list& bl) const {}
+ void decode(ceph::buffer::list::const_iterator& it) {}
+ void dump(ceph::Formatter *f) const {}
inline bool operator==(const UnknownSnapshotNamespace& gsn) const {
return true;
SnapshotNamespace(T&& t) : SnapshotNamespaceVariant(std::forward<T>(t)) {
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<SnapshotNamespace*> &o);
child_count(child_count) {
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<SnapshotInfo*> &o);
};
GROUP_SNAPSHOT_STATE_COMPLETE = 1,
};
-inline void encode(const GroupSnapshotState &state, bufferlist& bl, uint64_t features=0)
+inline void encode(const GroupSnapshotState &state, ceph::buffer::list& bl, uint64_t features=0)
{
using ceph::encode;
encode(static_cast<uint8_t>(state), bl);
}
-inline void decode(GroupSnapshotState &state, bufferlist::const_iterator& it)
+inline void decode(GroupSnapshotState &state, ceph::buffer::list::const_iterator& it)
{
using ceph::decode;
uint8_t int_state;
struct ImageSnapshotSpec {
int64_t pool;
- string image_id;
+ std::string image_id;
snapid_t snap_id;
ImageSnapshotSpec() {}
ImageSnapshotSpec(int64_t _pool,
- string _image_id,
+ std::string _image_id,
snapid_t _snap_id) : pool(_pool),
image_id(_image_id),
snap_id(_snap_id) {}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& it);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<ImageSnapshotSpec *> &o);
};
name(_name),
state(_state) {}
- vector<ImageSnapshotSpec> snaps;
+ std::vector<ImageSnapshotSpec> snaps;
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<GroupSnapshot *> &o);
};
return os;
}
-inline void encode(const TrashImageSource &source, bufferlist& bl,
+inline void encode(const TrashImageSource &source, ceph::buffer::list& bl,
uint64_t features=0)
{
using ceph::encode;
encode(static_cast<uint8_t>(source), bl);
}
-inline void decode(TrashImageSource &source, bufferlist::const_iterator& it)
+inline void decode(TrashImageSource &source, ceph::buffer::list::const_iterator& it)
{
uint8_t int_source;
using ceph::decode;
TRASH_IMAGE_STATE_RESTORING = 3
};
-inline void encode(const TrashImageState &state, bufferlist &bl)
+inline void encode(const TrashImageState &state, ceph::buffer::list &bl)
{
using ceph::encode;
encode(static_cast<uint8_t>(state), bl);
}
-inline void decode(TrashImageState &state, bufferlist::const_iterator &it)
+inline void decode(TrashImageState &state, ceph::buffer::list::const_iterator &it)
{
uint8_t int_state;
using ceph::decode;
deferment_end_time(deferment_end_time) {
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
+ void dump(ceph::Formatter *f) const;
inline bool operator==(const TrashImageSpec& rhs) const {
return (source == rhs.source &&
}
MirrorImageMap(const std::string &instance_id, utime_t mapped_time,
- const bufferlist &data)
+ const ceph::buffer::list &data)
: instance_id(instance_id),
mapped_time(mapped_time),
data(data) {
std::string instance_id;
utime_t mapped_time;
- bufferlist data;
+ ceph::buffer::list data;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<MirrorImageMap*> &o);
MIGRATION_HEADER_TYPE_DST = 2,
};
-inline void encode(const MigrationHeaderType &type, bufferlist& bl) {
+inline void encode(const MigrationHeaderType &type, ceph::buffer::list& bl) {
using ceph::encode;
encode(static_cast<uint8_t>(type), bl);
}
-inline void decode(MigrationHeaderType &type, bufferlist::const_iterator& it) {
+inline void decode(MigrationHeaderType &type, ceph::buffer::list::const_iterator& it) {
uint8_t int_type;
using ceph::decode;
decode(int_type, it);
MIGRATION_STATE_EXECUTED = 4,
};
-inline void encode(const MigrationState &state, bufferlist& bl) {
+inline void encode(const MigrationState &state, ceph::buffer::list& bl) {
using ceph::encode;
encode(static_cast<uint8_t>(state), bl);
}
-inline void decode(MigrationState &state, bufferlist::const_iterator& it) {
+inline void decode(MigrationState &state, ceph::buffer::list::const_iterator& it) {
uint8_t int_state;
using ceph::decode;
decode(int_state, it);
state_description(state_description) {
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& it);
- void dump(Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator& it);
+ void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<MigrationSpec*> &o);
ASSERT_SNAPC_SEQ_LE_SNAPSET_SEQ = 1,
};
-inline void encode(const AssertSnapcSeqState &state, bufferlist& bl) {
+inline void encode(const AssertSnapcSeqState &state, ceph::buffer::list& bl) {
using ceph::encode;
encode(static_cast<uint8_t>(state), bl);
}
-inline void decode(AssertSnapcSeqState &state, bufferlist::const_iterator& it) {
+inline void decode(AssertSnapcSeqState &state, ceph::buffer::list::const_iterator& it) {
uint8_t int_state;
using ceph::decode;
decode(int_state, it);
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include <errno.h>
#include "include/compat.h"
+using std::string;
+
+using ceph::bufferlist;
+
CLS_VER(1,0)
CLS_NAME(refcount)
-
#define REFCOUNT_ATTR "refcount"
static string wildcard_tag;
try {
auto iter = bl.cbegin();
decode(*objr, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: read_refcount(): failed to decode refcount entry\n");
return -EIO;
}
cls_refcount_get_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rc_refcount_get(): failed to decode entry\n");
return -EINVAL;
}
cls_refcount_put_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rc_refcount_put(): failed to decode entry\n");
return -EINVAL;
}
CLS_LOG(10, "cls_rc_refcount_put() tag=%s\n", op.tag.c_str());
bool found = false;
- map<string, bool>::iterator iter = objr.refs.find(op.tag);
+ auto iter = objr.refs.find(op.tag);
if (iter != objr.refs.end()) {
found = true;
} else if (op.implicit_ref) {
cls_refcount_set_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_refcount_set(): failed to decode entry\n");
return -EINVAL;
}
}
obj_refcount objr;
- list<string>::iterator iter;
- for (iter = op.refs.begin(); iter != op.refs.end(); ++iter) {
+ for (auto iter = op.refs.begin(); iter != op.refs.end(); ++iter) {
objr.refs[*iter] = true;
}
cls_refcount_read_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rc_refcount_read(): failed to decode entry\n");
return -EINVAL;
}
if (ret < 0)
return ret;
- map<string, bool>::iterator iter;
- for (iter = objr.refs.begin(); iter != objr.refs.end(); ++iter) {
+ for (auto iter = objr.refs.begin(); iter != objr.refs.end(); ++iter) {
read_ret.refs.push_back(iter->first);
}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#include <errno.h>
#include "cls/refcount/cls_refcount_client.h"
#include "cls/refcount/cls_refcount_ops.h"
#include "include/rados/librados.hpp"
-using namespace librados;
+using std::list;
+using std::string;
+using ceph::bufferlist;
void cls_refcount_get(librados::ObjectWriteOperation& op, const string& tag, bool implicit_ref)
{
try {
auto iter = out.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
return r;
}
-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_REFCOUNT_CLIENT_H
#define CEPH_CLS_REFCOUNT_CLIENT_H
* as the relevant tag, and the refcount will be decreased.
*/
-void cls_refcount_get(librados::ObjectWriteOperation& op, const string& tag, bool implicit_ref = false);
-void cls_refcount_put(librados::ObjectWriteOperation& op, const string& tag, bool implicit_ref = false);
-void cls_refcount_set(librados::ObjectWriteOperation& op, list<string>& refs);
+void cls_refcount_get(librados::ObjectWriteOperation& op, const std::string& tag, bool implicit_ref = false);
+void cls_refcount_put(librados::ObjectWriteOperation& op, const std::string& tag, bool implicit_ref = false);
+void cls_refcount_set(librados::ObjectWriteOperation& op, std::list<std::string>& refs);
// these overloads which call io_ctx.operate() or io_ctx.exec() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()/exec()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_refcount_read(librados::IoCtx& io_ctx, string& oid, list<string> *refs, bool implicit_ref = false);
+int cls_refcount_read(librados::IoCtx& io_ctx, std::string& oid, std::list<std::string> *refs, bool implicit_ref = false);
#endif
#endif
#include "common/Formatter.h"
#include "common/ceph_json.h"
+using std::list;
+
void cls_refcount_get_op::dump(ceph::Formatter *f) const
{
f->dump_string("tag", tag);
void cls_refcount_read_ret::dump(ceph::Formatter *f) const
{
f->open_array_section("refs");
- for (list<string>::const_iterator p = refs.begin(); p != refs.end(); ++p)
+ for (auto p = refs.begin(); p != refs.end(); ++p)
f->dump_string("ref", *p);
f->close_section();
}
#include "common/hobject.h"
struct cls_refcount_get_op {
- string tag;
+ std::string tag;
bool implicit_ref;
cls_refcount_get_op() : implicit_ref(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(tag, bl);
encode(implicit_ref, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(tag, bl);
decode(implicit_ref, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_refcount_get_op*>& ls);
+ static void generate_test_instances(std::list<cls_refcount_get_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_refcount_get_op)
struct cls_refcount_put_op {
- string tag;
+ std::string tag;
bool implicit_ref; // assume wildcard reference for
- // objects without a set ref
+ // objects without a std::set ref
cls_refcount_put_op() : implicit_ref(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(tag, bl);
encode(implicit_ref, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(tag, bl);
decode(implicit_ref, bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_refcount_put_op*>& ls);
+ static void generate_test_instances(std::list<cls_refcount_put_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_refcount_put_op)
struct cls_refcount_set_op {
- list<string> refs;
+ std::list<std::string> refs;
cls_refcount_set_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(refs, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(refs, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_refcount_set_op*>& ls);
+ static void generate_test_instances(std::list<cls_refcount_set_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_refcount_set_op)
struct cls_refcount_read_op {
bool implicit_ref; // assume wildcard reference for
- // objects without a set ref
+ // objects without a std::set ref
cls_refcount_read_op() : implicit_ref(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(implicit_ref, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(implicit_ref, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_refcount_read_op*>& ls);
+ static void generate_test_instances(std::list<cls_refcount_read_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_refcount_read_op)
struct cls_refcount_read_ret {
- list<string> refs;
+ std::list<std::string> refs;
cls_refcount_read_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(refs, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(refs, bl);
DECODE_FINISH(bl);
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<cls_refcount_read_ret*>& ls);
+ static void generate_test_instances(std::list<cls_refcount_read_ret*>& ls);
};
WRITE_CLASS_ENCODER(cls_refcount_read_ret)
struct obj_refcount {
- map<string, bool> refs;
- set<string> retired_refs;
+ std::map<std::string, bool> refs;
+ std::set<std::string> retired_refs;
obj_refcount() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(refs, bl);
encode(retired_refs, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(refs, bl);
if (struct_v >= 2) {
}
void dump(ceph::Formatter *f) const;
- static void generate_test_instances(list<obj_refcount*>& ls);
+ static void generate_test_instances(std::list<obj_refcount*>& ls);
};
WRITE_CLASS_ENCODER(obj_refcount)
#include "include/compat.h"
#include <boost/lexical_cast.hpp>
+using std::pair;
+using std::list;
+using std::map;
+using std::string;
+using std::vector;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+using ceph::make_timespan;
+using ceph::real_clock;
+using ceph::real_time;
+using ceph::timespan;
+
CLS_VER(1,0)
CLS_NAME(rgw)
return -EIO;
}
- list<string>::iterator iter = vals.begin();
+ auto iter = vals.begin();
key->name = *iter;
++iter;
auto iter = bl.cbegin();
try {
decode(*header, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: read_bucket_header(): failed to decode header\n");
return -EIO;
}
rgw_cls_list_op op;
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: %s: failed to decode request\n", __func__);
return -EINVAL;
}
const bufferlist& entrybl = kiter->second;
auto eiter = entrybl.cbegin();
decode(entry, eiter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: %s: failed to decode entry, key=%s\n",
__func__, kiter->first.c_str());
return -EINVAL;
if (rc < 0)
return rc;
- std::map<string, bufferlist>::iterator kiter = keys.begin();
- for (; kiter != keys.end(); ++kiter) {
+ for (auto kiter = keys.begin(); kiter != keys.end(); ++kiter) {
if (!bi_is_objs_index(kiter->first)) {
done = true;
break;
auto eiter = kiter->second.cbegin();
try {
decode(entry, eiter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_bucket_list(): failed to decode entry, key=%s\n", kiter->first.c_str());
return -EIO;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: %s(): failed to decode request\n", __func__);
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_bucket_set_tag_timeout(): failed to decode request\n");
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_bucket_prepare_op(): failed to decode request\n");
return -EINVAL;
}
auto cur_iter = current_entry.cbegin();
try {
decode(*entry, cur_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: %s(): failed to decode entry\n", __func__);
return -EIO;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_bucket_complete_op(): failed to decode request\n");
return -EINVAL;
}
rgw_bucket_dir_entry::FLAG_VER);
if (op.tag.size()) {
- map<string, rgw_bucket_pending_info>::iterator pinter = entry.pending_map.find(op.tag);
+ auto pinter = entry.pending_map.find(op.tag);
if (pinter == entry.pending_map.end()) {
CLS_LOG(1, "ERROR: couldn't find tag for pending operation\n");
return -EINVAL;
return rc;
}
- list<cls_rgw_obj_key>::iterator remove_iter;
CLS_LOG(20, "rgw_bucket_complete_op(): remove_objs.size()=%d\n", (int)op.remove_objs.size());
- for (remove_iter = op.remove_objs.begin(); remove_iter != op.remove_objs.end(); ++remove_iter) {
+ for (auto remove_iter = op.remove_objs.begin(); remove_iter != op.remove_objs.end(); ++remove_iter) {
cls_rgw_obj_key& remove_key = *remove_iter;
CLS_LOG(1, "rgw_bucket_complete_op(): removing entries, read_index_entry name=%s instance=%s\n",
remove_key.name.c_str(), remove_key.instance.c_str());
rgw_bucket_dir_entry next_entry;
- map<string, bufferlist>::reverse_iterator last = keys.rbegin();
+ auto last = keys.rbegin();
try {
auto iter = last->second.cbegin();
decode(next_entry, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR; failed to decode entry: %s", last->first.c_str());
return -EIO;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: rgw_bucket_link_olh_op(): failed to decode request\n");
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: rgw_bucket_rm_obj_instance_op(): failed to decode request\n");
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: rgw_bucket_read_olh_log(): failed to decode request\n");
return -EINVAL;
}
op_ret.log = log;
op_ret.is_truncated = false;
} else {
- map<uint64_t, vector<rgw_bucket_olh_log_entry> >::iterator iter = log.upper_bound(op.ver_marker);
+ auto iter = log.upper_bound(op.ver_marker);
for (int i = 0; i < MAX_OLH_LOG_ENTRIES && iter != log.end(); ++i, ++iter) {
op_ret.log[iter->first] = iter->second;
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: rgw_bucket_trim_olh_log(): failed to decode request\n");
return -EINVAL;
}
}
/* remove all versions up to and including ver from the pending map */
- map<uint64_t, vector<rgw_bucket_olh_log_entry> >& log = olh_data_entry.pending_log;
- map<uint64_t, vector<rgw_bucket_olh_log_entry> >::iterator liter = log.begin();
+ auto& log = olh_data_entry.pending_log;
+ auto liter = log.begin();
while (liter != log.end() && liter->first <= op.ver) {
- map<uint64_t, vector<rgw_bucket_olh_log_entry> >::iterator rm_iter = liter;
+ auto rm_iter = liter;
++liter;
log.erase(rm_iter);
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: rgw_bucket_clear_olh(): failed to decode request\n");
return -EINVAL;
}
try {
decode(op, in_iter);
decode(cur_change, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_dir_suggest_changes(): failed to decode request\n");
return -EINVAL;
}
auto cur_disk_iter = cur_disk_bl.cbegin();
try {
decode(cur_disk, cur_disk_iter);
- } catch (buffer::error& error) {
+ } catch (ceph::buffer::error& error) {
CLS_LOG(1, "ERROR: rgw_dir_suggest_changes(): failed to decode cur_disk\n");
return -EINVAL;
}
real_time cur_time = real_clock::now();
- map<string, rgw_bucket_pending_info>::iterator iter =
- cur_disk.pending_map.begin();
+ auto iter = cur_disk.pending_map.begin();
while(iter != cur_disk.pending_map.end()) {
- map<string, rgw_bucket_pending_info>::iterator cur_iter=iter++;
+ auto cur_iter = iter++;
if (cur_time > (cur_iter->second.timestamp + timespan(tag_timeout))) {
cur_disk.pending_map.erase(cur_iter);
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
}
map<string, bufferlist> new_attrs;
- for (list<string>::iterator iter = op.keep_attr_prefixes.begin();
+ for (auto iter = op.keep_attr_prefixes.begin();
iter != op.keep_attr_prefixes.end(); ++iter) {
- string& check_prefix = *iter;
+ auto& check_prefix = *iter;
- for (map<string, bufferlist>::iterator aiter = attrset.lower_bound(check_prefix);
+ for (auto aiter = attrset.lower_bound(check_prefix);
aiter != attrset.end(); ++aiter) {
const string& attr = aiter->first;
return ret;
}
- for (map<string, bufferlist>::iterator aiter = new_attrs.begin();
+ for (auto aiter = new_attrs.begin();
aiter != new_attrs.end(); ++aiter) {
- const string& attr = aiter->first;
+ const auto& attr = aiter->first;
ret = cls_cxx_setxattr(hctx, attr.c_str(), &aiter->second);
CLS_LOG(20, "%s(): setting attr: %s", __func__, attr.c_str());
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
bool exist = false;
- for (map<string, bufferlist>::iterator aiter = attrset.lower_bound(op.check_prefix);
+ for (auto aiter = attrset.lower_bound(op.check_prefix);
aiter != attrset.end(); ++aiter) {
- const string& attr = aiter->first;
+ const auto& attr = aiter->first;
if (attr.substr(0, op.check_prefix.size()) > op.check_prefix) {
break;
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
return ret;
}
- map<string, bufferlist>::iterator iter;
- for (iter = keys.begin(); iter != keys.end(); ++iter) {
+ for (auto iter = keys.begin(); iter != keys.end(); ++iter) {
if (iter->first >= end_key) {
/* past the end of plain namespace */
if (pmore) {
rgw_bucket_dir_entry e;
try {
decode(e, biter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode buffer", __func__);
return -EIO;
}
keys[start_after_key].claim(k);
}
- map<string, bufferlist>::iterator iter;
- for (iter = keys.begin(); iter != keys.end(); ++iter) {
+ for (auto iter = keys.begin(); iter != keys.end(); ++iter) {
rgw_cls_bi_entry entry;
entry.type = BIIndexType::Instance;
entry.idx = iter->first;
rgw_bucket_dir_entry e;
try {
decode(e, biter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode buffer (size=%d)", __func__, entry.data.length());
return -EIO;
}
keys[start_after_key].claim(k);
}
- map<string, bufferlist>::iterator iter;
- for (iter = keys.begin(); iter != keys.end(); ++iter) {
+ for (auto iter = keys.begin(); iter != keys.end(); ++iter) {
rgw_cls_bi_entry entry;
entry.type = BIIndexType::OLH;
entry.idx = iter->first;
rgw_bucket_olh_entry e;
try {
decode(e, biter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode buffer (size=%d)", __func__, entry.data.length());
return -EIO;
}
auto iter = in->cbegin();
try {
decode(op, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s(): failed to decode request", __func__);
return -EINVAL;
}
auto iter = bl.cbegin();
try {
decode(e, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: failed to decode rgw_bi_log_entry");
return -EIO;
}
if (ret < 0)
return ret;
- map<string, bufferlist>::iterator iter = keys.begin();
+ auto iter = keys.begin();
if (iter == keys.end())
return 0;
cls_rgw_bi_log_list_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_bi_log_list(): failed to decode entry\n");
return -EINVAL;
}
cls_rgw_bi_log_trim_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_bi_log_list(): failed to decode entry\n");
return -EINVAL;
}
auto kiter = record_bl.cbegin();
try {
decode(e, kiter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: usage_record_decode(): failed to decode record_bl\n");
return -EINVAL;
}
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_user_usage_log_add(): failed to decode request\n");
return -EINVAL;
}
rgw_usage_log_info& info = op.info;
- vector<rgw_usage_log_entry>::iterator iter;
- for (iter = info.entries.begin(); iter != info.entries.end(); ++iter) {
+ for (auto iter = info.entries.begin(); iter != info.entries.end(); ++iter) {
rgw_usage_log_entry& entry = *iter;
string key_by_time;
return ret;
*truncated = truncated_status;
-
- map<string, bufferlist>::iterator iter = keys.begin();
+
+ auto iter = keys.begin();
if (iter == keys.end())
return 0;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_user_usage_log_read(): failed to decode request\n");
return -EINVAL;
}
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_user_log_usage_log_trim(): failed to decode request\n");
return -EINVAL;
}
auto iter = bl.cbegin();
try {
decode(e, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: failed to decode cls_rgw_gc_obj_info");
return -EIO;
}
cls_rgw_gc_set_entry_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_gc_set_entry(): failed to decode entry\n");
return -EINVAL;
}
cls_rgw_gc_defer_entry_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_gc_defer_entry(): failed to decode entry\n");
return -EINVAL;
}
if (ret < 0)
return ret;
- map<string, bufferlist>::iterator iter = keys.begin();
+ auto iter = keys.begin();
if (iter == keys.end()) {
// if keys empty must not come back as truncated
ceph_assert(!truncated || !(*truncated));
cls_rgw_gc_list_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_gc_list(): failed to decode entry\n");
return -EINVAL;
}
cls_rgw_gc_remove_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_gc_remove(): failed to decode entry\n");
return -EINVAL;
}
cls_rgw_lc_get_entry_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_set_entry(): failed to decode entry\n");
return -EINVAL;
}
cls_rgw_lc_set_entry_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_set_entry(): failed to decode entry\n");
return -EINVAL;
}
cls_rgw_lc_rm_entry_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_rm_entry(): failed to decode entry\n");
return -EINVAL;
}
cls_rgw_lc_get_next_entry_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_get_next_entry: failed to decode op\n");
return -EINVAL;
}
int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix, 1, &vals, &more);
if (ret < 0)
return ret;
- map<string, bufferlist>::iterator it;
pair<string, int> entry;
if (!vals.empty()) {
- it=vals.begin();
+ auto it = vals.begin();
in_iter = it->second.begin();
try {
decode(entry, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_get_next_entry(): failed to decode entry\n");
return -EIO;
}
auto in_iter = in->cbegin();
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_list_entries(): failed to decode op\n");
return -EINVAL;
}
cls_rgw_lc_list_entries_ret op_ret;
- bufferlist::const_iterator iter;
map<string, bufferlist> vals;
string filter_prefix;
int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix, op.max_entries, &vals, &op_ret.is_truncated);
if (ret < 0)
return ret;
- map<string, bufferlist>::iterator it;
pair<string, int> entry;
- for (it = vals.begin(); it != vals.end(); ++it) {
- iter = it->second.cbegin();
+ for (auto it = vals.begin(); it != vals.end(); ++it) {
+ auto iter = it->second.cbegin();
try {
- decode(entry, iter);
- } catch (buffer::error& err) {
+ decode(entry, iter);
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_list_entries(): failed to decode entry\n");
return -EIO;
}
cls_rgw_lc_put_head_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_put_head(): failed to decode entry\n");
return -EINVAL;
}
auto iter = bl.cbegin();
try {
decode(head, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: rgw_cls_lc_get_head(): failed to decode entry %s\n",err.what());
return -EINVAL;
}
cls_rgw_reshard_add_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_reshard_add: failed to decode entry\n");
return -EINVAL;
}
auto in_iter = in->cbegin();
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_rehard_list(): failed to decode entry\n");
return -EINVAL;
}
cls_rgw_reshard_list_ret op_ret;
- bufferlist::const_iterator iter;
map<string, bufferlist> vals;
string filter_prefix;
#define MAX_RESHARD_LIST_ENTRIES 1000
int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix, max, &vals, &op_ret.is_truncated);
if (ret < 0)
return ret;
- map<string, bufferlist>::iterator it;
cls_rgw_reshard_entry entry;
int i = 0;
- for (it = vals.begin(); i < (int)op.max && it != vals.end(); ++it, ++i) {
- iter = it->second.cbegin();
+ for (auto it = vals.begin(); i < (int)op.max && it != vals.end(); ++it, ++i) {
+ auto iter = it->second.cbegin();
try {
decode(entry, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_rehard_list(): failed to decode entry\n");
return -EIO;
}
cls_rgw_reshard_get_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_reshard_get: failed to decode entry\n");
return -EINVAL;
}
cls_rgw_reshard_remove_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_rehard_remove: failed to decode entry\n");
return -EINVAL;
}
auto in_iter = in->cbegin();
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rgw_set_bucket_resharding: failed to decode entry\n");
return -EINVAL;
}
auto in_iter = in->cbegin();
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rgw_clear_bucket_resharding: failed to decode entry\n");
return -EINVAL;
}
auto in_iter = in->cbegin();
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: %s(): failed to decode entry\n", __func__);
return -EINVAL;
}
auto in_iter = in->cbegin();
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: %s(): failed to decode entry\n", __func__);
return -EINVAL;
}
#include "common/debug.h"
+using std::list;
+using std::map;
+using std::pair;
+using std::string;
+using std::vector;
+
+using ceph::real_time;
+
using namespace librados;
const string BucketIndexShardsManager::KEY_VALUE_SEPARATOR = "#";
try {
auto iter = outbl.cbegin();
decode((*data), iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
r = -EIO;
}
}
void BucketIndexAioManager::do_completion(int id) {
std::lock_guard l{lock};
- map<int, librados::AioCompletion*>::iterator iter = pendings.find(id);
+ auto iter = pendings.find(id);
ceph_assert(iter != pendings.end());
completions[id] = iter->second;
pendings.erase(iter);
// If the caller needs a list of finished objects, store them
// for further processing
- map<int, string>::iterator miter = pending_objs.find(id);
+ auto miter = pending_objs.find(id);
if (miter != pending_objs.end()) {
completion_objs[id] = miter->second;
pending_objs.erase(miter);
}
// Clear the completed AIOs
- map<int, librados::AioCompletion*>::iterator iter = completions.begin();
+ auto iter = completions.begin();
for (; iter != completions.end(); ++iter) {
int r = iter->second->get_return_value();
if (objs && r == 0) { /* update list of successfully completed objs */
- map<int, string>::iterator liter = completion_objs.find(iter->first);
+ auto liter = completion_objs.find(iter->first);
if (liter != completion_objs.end()) {
(*objs)[liter->first] = liter->second;
}
auto iter = out.cbegin();
try {
decode(op_ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
auto iter = out.cbegin();
try {
decode(op_ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
try {
auto iter = outbl.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
r = -EIO;
}
*is_truncated = result.truncated;
usage = result.usage;
- } catch (buffer::error& e) {
+ } catch (ceph::buffer::error& e) {
return -EINVAL;
}
try {
auto iter = out.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
try {
auto iter = out.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
head = ret.head;
try {
auto iter = out.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
entry = ret.entry;
try {
auto iter = out.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
try {
auto iter = out.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
entries.insert(ret.entries.begin(),ret.entries.end());
auto iter = out.cbegin();
try {
decode(op_ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
auto iter = out.cbegin();
try {
decode(op_ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
auto iter = out.cbegin();
try {
decode(op_ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_CLS_RGW_CLIENT_H
*/
class BucketIndexAioManager {
private:
- map<int, librados::AioCompletion*> pendings;
- map<int, librados::AioCompletion*> completions;
- map<int, string> pending_objs;
- map<int, string> completion_objs;
+ std::map<int, librados::AioCompletion*> pendings;
+ std::map<int, librados::AioCompletion*> completions;
+ std::map<int, std::string> pending_objs;
+ std::map<int, std::string> completion_objs;
int next = 0;
ceph::mutex lock = ceph::make_mutex("BucketIndexAioManager::lock");
ceph::condition_variable cond;
* @param oid - the object id associated with the object, if it is NULL, we don't
* track the object id per callback.
*/
- void add_pending(int id, librados::AioCompletion* completion, const string& oid) {
+ void add_pending(int id, librados::AioCompletion* completion, const std::string& oid) {
pendings[id] = completion;
pending_objs[id] = oid;
}
* valid_ret_code - valid AIO return code.
* num_completions - number of completions.
* ret_code - return code of failed AIO.
- * objs - a list of objects that has been finished the AIO.
+ * objs - a std::list of objects that has been finished the AIO.
*
* Return false if there is no pending AIO, true otherwise.
*/
bool wait_for_completions(int valid_ret_code, int *num_completions, int *ret_code,
- map<int, string> *objs);
+ std::map<int, std::string> *objs);
/**
* Do aio read operation.
*/
- bool aio_operate(librados::IoCtx& io_ctx, const string& oid, librados::ObjectReadOperation *op) {
+ bool aio_operate(librados::IoCtx& io_ctx, const std::string& oid, librados::ObjectReadOperation *op) {
std::lock_guard l{lock};
BucketIndexAioArg *arg = new BucketIndexAioArg(get_next(), this);
librados::AioCompletion *c = librados::Rados::aio_create_completion((void*)arg, bucket_index_op_completion_cb);
/**
* Do aio write operation.
*/
- bool aio_operate(librados::IoCtx& io_ctx, const string& oid, librados::ObjectWriteOperation *op) {
+ bool aio_operate(librados::IoCtx& io_ctx, const std::string& oid, librados::ObjectWriteOperation *op) {
std::lock_guard l{lock};
BucketIndexAioArg *arg = new BucketIndexAioArg(get_next(), this);
librados::AioCompletion *c = librados::Rados::aio_create_completion((void*)arg, bucket_index_op_completion_cb);
class BucketIndexShardsManager {
private:
// Per shard setting manager, for example, marker.
- map<int, string> value_by_shards;
+ std::map<int, std::string> value_by_shards;
public:
- const static string KEY_VALUE_SEPARATOR;
- const static string SHARDS_SEPARATOR;
+ const static std::string KEY_VALUE_SEPARATOR;
+ const static std::string SHARDS_SEPARATOR;
- void add(int shard, const string& value) {
+ void add(int shard, const std::string& value) {
value_by_shards[shard] = value;
}
- const string& get(int shard, const string& default_value) {
- map<int, string>::iterator iter = value_by_shards.find(shard);
+ const std::string& get(int shard, const std::string& default_value) {
+ auto iter = value_by_shards.find(shard);
return (iter == value_by_shards.end() ? default_value : iter->second);
}
- map<int, string>& get() {
+ std::map<int, std::string>& get() {
return value_by_shards;
}
return value_by_shards.empty();
}
- void to_string(string *out) const {
+ void to_string(std::string *out) const {
if (!out) {
return;
}
out->clear();
- map<int, string>::const_iterator iter = value_by_shards.begin();
- for (; iter != value_by_shards.end(); ++iter) {
+ for (auto iter = value_by_shards.begin();
+ iter != value_by_shards.end(); ++iter) {
if (out->length()) {
// Not the first item, append a separator first
out->append(SHARDS_SEPARATOR);
}
}
- static bool is_shards_marker(const string& marker) {
- return marker.find(KEY_VALUE_SEPARATOR) != string::npos;
+ static bool is_shards_marker(const std::string& marker) {
+ return marker.find(KEY_VALUE_SEPARATOR) != std::string::npos;
}
/*
- * convert from string. There are two options of how the string looks like:
+ * convert from std::string. There are two options of how the std::string looks like:
*
* 1. Single shard, no shard id specified, e.g. 000001.23.1
*
* 2. One or more shards, shard id specified for each shard, e.g., 0#00002.12,1#00003.23.2
*
*/
- int from_string(const string& composed_marker, int shard_id) {
+ int from_string(const std::string& composed_marker, int shard_id) {
value_by_shards.clear();
- vector<string> shards;
+ std::vector<std::string> shards;
get_str_vec(composed_marker, SHARDS_SEPARATOR.c_str(), shards);
if (shards.size() > 1 && shard_id >= 0) {
return -EINVAL;
}
- vector<string>::const_iterator iter = shards.begin();
- for (; iter != shards.end(); ++iter) {
+ for (auto iter = shards.begin(); iter != shards.end(); ++iter) {
size_t pos = iter->find(KEY_VALUE_SEPARATOR);
- if (pos == string::npos) {
+ if (pos == std::string::npos) {
if (!value_by_shards.empty()) {
return -EINVAL;
}
}
return 0;
}
- string shard_str = iter->substr(0, pos);
- string err;
+ std::string shard_str = iter->substr(0, pos);
+ std::string err;
int shard = (int)strict_strtol(shard_str.c_str(), 10, &err);
if (!err.empty()) {
return -EINVAL;
class CLSRGWConcurrentIO {
protected:
librados::IoCtx& io_ctx;
- map<int, string>& objs_container;
- map<int, string>::iterator iter;
+ std::map<int, std::string>& objs_container;
+ std::map<int, std::string>::iterator iter;
uint32_t max_aio;
BucketIndexAioManager manager;
- virtual int issue_op(int shard_id, const string& oid) = 0;
+ virtual int issue_op(int shard_id, const std::string& oid) = 0;
virtual void cleanup() {}
virtual int valid_ret_code() { return 0; }
// OP needs to be re-send until a certain code is returned.
virtual bool need_multiple_rounds() { return false; }
// Add a new object to the end of the container.
- virtual void add_object(int shard, const string& oid) {}
- virtual void reset_container(map<int, string>& objs) {}
+ virtual void add_object(int shard, const std::string& oid) {}
+ virtual void reset_container(std::map<int, std::string>& objs) {}
public:
CLSRGWConcurrentIO(librados::IoCtx& ioc,
- map<int, string>& _objs_container,
+ std::map<int, std::string>& _objs_container,
uint32_t _max_aio) :
io_ctx(ioc), objs_container(_objs_container), max_aio(_max_aio)
{}
}
int num_completions = 0, r = 0;
- map<int, string> objs;
- map<int, string> *pobjs = (need_multiple_rounds() ? &objs : NULL);
+ std::map<int, std::string> objs;
+ std::map<int, std::string> *pobjs = (need_multiple_rounds() ? &objs : NULL);
while (manager.wait_for_completions(valid_ret_code(), &num_completions, &r, pobjs)) {
if (r >= 0 && ret >= 0) {
for (; num_completions && iter != objs_container.end(); --num_completions, ++iter) {
class CLSRGWIssueBucketIndexInit : public CLSRGWConcurrentIO {
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
int valid_ret_code() override { return -EEXIST; }
void cleanup() override;
public:
- CLSRGWIssueBucketIndexInit(librados::IoCtx& ioc, map<int, string>& _bucket_objs,
+ CLSRGWIssueBucketIndexInit(librados::IoCtx& ioc, std::map<int, std::string>& _bucket_objs,
uint32_t _max_aio) :
CLSRGWConcurrentIO(ioc, _bucket_objs, _max_aio) {}
};
class CLSRGWIssueBucketIndexClean : public CLSRGWConcurrentIO {
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
int valid_ret_code() override {
return -ENOENT;
}
public:
CLSRGWIssueBucketIndexClean(librados::IoCtx& ioc,
- map<int, string>& _bucket_objs,
+ std::map<int, std::string>& _bucket_objs,
uint32_t _max_aio) :
CLSRGWConcurrentIO(ioc, _bucket_objs, _max_aio)
{}
class CLSRGWIssueSetTagTimeout : public CLSRGWConcurrentIO {
uint64_t tag_timeout;
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
public:
- CLSRGWIssueSetTagTimeout(librados::IoCtx& ioc, map<int, string>& _bucket_objs,
+ CLSRGWIssueSetTagTimeout(librados::IoCtx& ioc, std::map<int, std::string>& _bucket_objs,
uint32_t _max_aio, uint64_t _tag_timeout) :
CLSRGWConcurrentIO(ioc, _bucket_objs, _max_aio), tag_timeout(_tag_timeout) {}
};
void cls_rgw_bucket_update_stats(librados::ObjectWriteOperation& o,
bool absolute,
- const map<RGWObjCategory, rgw_bucket_category_stats>& stats);
+ const std::map<RGWObjCategory, rgw_bucket_category_stats>& stats);
-void cls_rgw_bucket_prepare_op(librados::ObjectWriteOperation& o, RGWModifyOp op, string& tag,
- const cls_rgw_obj_key& key, const string& locator, bool log_op,
+void cls_rgw_bucket_prepare_op(librados::ObjectWriteOperation& o, RGWModifyOp op, std::string& tag,
+ const cls_rgw_obj_key& key, const std::string& locator, bool log_op,
uint16_t bilog_op, rgw_zone_set& zones_trace);
-void cls_rgw_bucket_complete_op(librados::ObjectWriteOperation& o, RGWModifyOp op, string& tag,
+void cls_rgw_bucket_complete_op(librados::ObjectWriteOperation& o, RGWModifyOp op, std::string& tag,
rgw_bucket_entry_ver& ver,
const cls_rgw_obj_key& key,
rgw_bucket_dir_entry_meta& dir_meta,
- list<cls_rgw_obj_key> *remove_objs, bool log_op,
+ std::list<cls_rgw_obj_key> *remove_objs, bool log_op,
uint16_t bilog_op, rgw_zone_set *zones_trace);
-void cls_rgw_remove_obj(librados::ObjectWriteOperation& o, list<string>& keep_attr_prefixes);
-void cls_rgw_obj_store_pg_ver(librados::ObjectWriteOperation& o, const string& attr);
-void cls_rgw_obj_check_attrs_prefix(librados::ObjectOperation& o, const string& prefix, bool fail_if_exist);
+void cls_rgw_remove_obj(librados::ObjectWriteOperation& o, std::list<std::string>& keep_attr_prefixes);
+void cls_rgw_obj_store_pg_ver(librados::ObjectWriteOperation& o, const std::string& attr);
+void cls_rgw_obj_check_attrs_prefix(librados::ObjectOperation& o, const std::string& prefix, bool fail_if_exist);
void cls_rgw_obj_check_mtime(librados::ObjectOperation& o, const ceph::real_time& mtime, bool high_precision_time, RGWCheckMTimeType type);
-int cls_rgw_bi_get(librados::IoCtx& io_ctx, const string oid,
+int cls_rgw_bi_get(librados::IoCtx& io_ctx, const std::string oid,
BIIndexType index_type, cls_rgw_obj_key& key,
rgw_cls_bi_entry *entry);
-int cls_rgw_bi_put(librados::IoCtx& io_ctx, const string oid, rgw_cls_bi_entry& entry);
-void cls_rgw_bi_put(librados::ObjectWriteOperation& op, const string oid, rgw_cls_bi_entry& entry);
-int cls_rgw_bi_list(librados::IoCtx& io_ctx, const string oid,
- const string& name, const string& marker, uint32_t max,
- list<rgw_cls_bi_entry> *entries, bool *is_truncated);
+int cls_rgw_bi_put(librados::IoCtx& io_ctx, const std::string oid, rgw_cls_bi_entry& entry);
+void cls_rgw_bi_put(librados::ObjectWriteOperation& op, const std::string oid, rgw_cls_bi_entry& entry);
+int cls_rgw_bi_list(librados::IoCtx& io_ctx, const std::string oid,
+ const std::string& name, const std::string& marker, uint32_t max,
+ std::list<rgw_cls_bi_entry> *entries, bool *is_truncated);
void cls_rgw_bucket_link_olh(librados::ObjectWriteOperation& op,
- const cls_rgw_obj_key& key, bufferlist& olh_tag,
- bool delete_marker, const string& op_tag, rgw_bucket_dir_entry_meta *meta,
+ const cls_rgw_obj_key& key, ceph::buffer::list& olh_tag,
+ bool delete_marker, const std::string& op_tag, rgw_bucket_dir_entry_meta *meta,
uint64_t olh_epoch, ceph::real_time unmod_since, bool high_precision_time, bool log_op, rgw_zone_set& zones_trace);
void cls_rgw_bucket_unlink_instance(librados::ObjectWriteOperation& op,
- const cls_rgw_obj_key& key, const string& op_tag,
- const string& olh_tag, uint64_t olh_epoch, bool log_op, rgw_zone_set& zones_trace);
-void cls_rgw_get_olh_log(librados::ObjectReadOperation& op, const cls_rgw_obj_key& olh, uint64_t ver_marker, const string& olh_tag, rgw_cls_read_olh_log_ret& log_ret, int& op_ret);
-void cls_rgw_trim_olh_log(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, uint64_t ver, const string& olh_tag);
-void cls_rgw_clear_olh(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, const string& olh_tag);
+ const cls_rgw_obj_key& key, const std::string& op_tag,
+ const std::string& olh_tag, uint64_t olh_epoch, bool log_op, rgw_zone_set& zones_trace);
+void cls_rgw_get_olh_log(librados::ObjectReadOperation& op, const cls_rgw_obj_key& olh, uint64_t ver_marker, const std::string& olh_tag, rgw_cls_read_olh_log_ret& log_ret, int& op_ret);
+void cls_rgw_trim_olh_log(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, uint64_t ver, const std::string& olh_tag);
+void cls_rgw_clear_olh(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, const std::string& olh_tag);
// these overloads which call io_ctx.operate() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_rgw_bucket_link_olh(librados::IoCtx& io_ctx, const string& oid,
- const cls_rgw_obj_key& key, bufferlist& olh_tag,
- bool delete_marker, const string& op_tag, rgw_bucket_dir_entry_meta *meta,
+int cls_rgw_bucket_link_olh(librados::IoCtx& io_ctx, const std::string& oid,
+ const cls_rgw_obj_key& key, ceph::buffer::list& olh_tag,
+ bool delete_marker, const std::string& op_tag, rgw_bucket_dir_entry_meta *meta,
uint64_t olh_epoch, ceph::real_time unmod_since, bool high_precision_time, bool log_op, rgw_zone_set& zones_trace);
-int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const string& oid,
- const cls_rgw_obj_key& key, const string& op_tag,
- const string& olh_tag, uint64_t olh_epoch, bool log_op, rgw_zone_set& zones_trace);
-int cls_rgw_get_olh_log(librados::IoCtx& io_ctx, string& oid, const cls_rgw_obj_key& olh, uint64_t ver_marker,
- const string& olh_tag, rgw_cls_read_olh_log_ret& log_ret);
-int cls_rgw_clear_olh(librados::IoCtx& io_ctx, string& oid, const cls_rgw_obj_key& olh, const string& olh_tag);
-int cls_rgw_usage_log_trim(librados::IoCtx& io_ctx, const string& oid, const string& user, const string& bucket,
+int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const std::string& oid,
+ const cls_rgw_obj_key& key, const std::string& op_tag,
+ const std::string& olh_tag, uint64_t olh_epoch, bool log_op, rgw_zone_set& zones_trace);
+int cls_rgw_get_olh_log(librados::IoCtx& io_ctx, std::string& oid, const cls_rgw_obj_key& olh, uint64_t ver_marker,
+ const std::string& olh_tag, rgw_cls_read_olh_log_ret& log_ret);
+int cls_rgw_clear_olh(librados::IoCtx& io_ctx, std::string& oid, const cls_rgw_obj_key& olh, const std::string& olh_tag);
+int cls_rgw_usage_log_trim(librados::IoCtx& io_ctx, const std::string& oid, const std::string& user, const std::string& bucket,
uint64_t start_epoch, uint64_t end_epoch);
#endif
/**
- * List the bucket with the starting object and filter prefix.
+ * Std::list the bucket with the starting object and filter prefix.
* NOTE: this method do listing requests for each bucket index shards identified by
- * the keys of the *list_results* map, which means the map should be popludated
+ * the keys of the *list_results* std::map, which means the std::map should be popludated
* by the caller to fill with each bucket index object id.
*
* io_ctx - IO context for rados.
* filter_prefix - filter prefix.
* num_entries - number of entries to request for each object (note the total
* amount of entries returned depends on the number of shardings).
- * list_results - the list results keyed by bucket index object id.
+ * list_results - the std::list results keyed by bucket index object id.
* max_aio - the maximum number of AIO (for throttling).
*
* Return 0 on success, a failure code otherwise.
class CLSRGWIssueBucketList : public CLSRGWConcurrentIO {
cls_rgw_obj_key start_obj;
- string filter_prefix;
- string delimiter;
+ std::string filter_prefix;
+ std::string delimiter;
uint32_t num_entries;
bool list_versions;
- map<int, rgw_cls_list_ret>& result;
+ std::map<int, rgw_cls_list_ret>& result;
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
public:
CLSRGWIssueBucketList(librados::IoCtx& io_ctx,
const cls_rgw_obj_key& _start_obj,
- const string& _filter_prefix,
- const string& _delimiter,
+ const std::string& _filter_prefix,
+ const std::string& _delimiter,
uint32_t _num_entries,
bool _list_versions,
- map<int, string>& oids,
- map<int, rgw_cls_list_ret>& list_results,
+ std::map<int, std::string>& oids,
+ std::map<int, rgw_cls_list_ret>& list_results,
uint32_t max_aio) :
CLSRGWConcurrentIO(io_ctx, oids, max_aio),
start_obj(_start_obj), filter_prefix(_filter_prefix), delimiter(_delimiter),
cls_rgw_bi_log_list_ret *pdata, int *ret = nullptr);
class CLSRGWIssueBILogList : public CLSRGWConcurrentIO {
- map<int, cls_rgw_bi_log_list_ret>& result;
+ std::map<int, cls_rgw_bi_log_list_ret>& result;
BucketIndexShardsManager& marker_mgr;
uint32_t max;
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
public:
CLSRGWIssueBILogList(librados::IoCtx& io_ctx, BucketIndexShardsManager& _marker_mgr, uint32_t _max,
- map<int, string>& oids,
- map<int, cls_rgw_bi_log_list_ret>& bi_log_lists, uint32_t max_aio) :
+ std::map<int, std::string>& oids,
+ std::map<int, cls_rgw_bi_log_list_ret>& bi_log_lists, uint32_t max_aio) :
CLSRGWConcurrentIO(io_ctx, oids, max_aio), result(bi_log_lists),
marker_mgr(_marker_mgr), max(_max) {}
};
BucketIndexShardsManager& start_marker_mgr;
BucketIndexShardsManager& end_marker_mgr;
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
// Trim until -ENODATA is returned.
int valid_ret_code() override { return -ENODATA; }
bool need_multiple_rounds() override { return true; }
- void add_object(int shard, const string& oid) override { objs_container[shard] = oid; }
- void reset_container(map<int, string>& objs) override {
+ void add_object(int shard, const std::string& oid) override { objs_container[shard] = oid; }
+ void reset_container(std::map<int, std::string>& objs) override {
objs_container.swap(objs);
iter = objs_container.begin();
objs.clear();
}
public:
CLSRGWIssueBILogTrim(librados::IoCtx& io_ctx, BucketIndexShardsManager& _start_marker_mgr,
- BucketIndexShardsManager& _end_marker_mgr, map<int, string>& _bucket_objs, uint32_t max_aio) :
+ BucketIndexShardsManager& _end_marker_mgr, std::map<int, std::string>& _bucket_objs, uint32_t max_aio) :
CLSRGWConcurrentIO(io_ctx, _bucket_objs, max_aio),
start_marker_mgr(_start_marker_mgr), end_marker_mgr(_end_marker_mgr) {}
};
*
* Return 0 on success, a failure code otherwise.
*/
-class CLSRGWIssueBucketCheck : public CLSRGWConcurrentIO /*<map<string, rgw_cls_check_index_ret> >*/ {
- map<int, rgw_cls_check_index_ret>& result;
+class CLSRGWIssueBucketCheck : public CLSRGWConcurrentIO /*<std::map<std::string, rgw_cls_check_index_ret> >*/ {
+ std::map<int, rgw_cls_check_index_ret>& result;
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
public:
- CLSRGWIssueBucketCheck(librados::IoCtx& ioc, map<int, string>& oids,
- map<int, rgw_cls_check_index_ret>& bucket_objs_ret,
+ CLSRGWIssueBucketCheck(librados::IoCtx& ioc, std::map<int, std::string>& oids,
+ std::map<int, rgw_cls_check_index_ret>& bucket_objs_ret,
uint32_t _max_aio) :
CLSRGWConcurrentIO(ioc, oids, _max_aio), result(bucket_objs_ret) {}
};
class CLSRGWIssueBucketRebuild : public CLSRGWConcurrentIO {
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
public:
- CLSRGWIssueBucketRebuild(librados::IoCtx& io_ctx, map<int, string>& bucket_objs,
+ CLSRGWIssueBucketRebuild(librados::IoCtx& io_ctx, std::map<int, std::string>& bucket_objs,
uint32_t max_aio) : CLSRGWConcurrentIO(io_ctx, bucket_objs, max_aio) {}
};
class CLSRGWIssueGetDirHeader : public CLSRGWConcurrentIO {
- map<int, rgw_cls_list_ret>& result;
+ std::map<int, rgw_cls_list_ret>& result;
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
public:
- CLSRGWIssueGetDirHeader(librados::IoCtx& io_ctx, map<int, string>& oids, map<int, rgw_cls_list_ret>& dir_headers,
+ CLSRGWIssueGetDirHeader(librados::IoCtx& io_ctx, std::map<int, std::string>& oids, std::map<int, rgw_cls_list_ret>& dir_headers,
uint32_t max_aio) :
CLSRGWConcurrentIO(io_ctx, oids, max_aio), result(dir_headers) {}
};
class CLSRGWIssueSetBucketResharding : public CLSRGWConcurrentIO {
cls_rgw_bucket_instance_entry entry;
protected:
- int issue_op(int shard_id, const string& oid) override;
+ int issue_op(int shard_id, const std::string& oid) override;
public:
- CLSRGWIssueSetBucketResharding(librados::IoCtx& ioc, map<int, string>& _bucket_objs,
+ CLSRGWIssueSetBucketResharding(librados::IoCtx& ioc, std::map<int, std::string>& _bucket_objs,
const cls_rgw_bucket_instance_entry& _entry,
uint32_t _max_aio) : CLSRGWConcurrentIO(ioc, _bucket_objs, _max_aio), entry(_entry) {}
};
class CLSRGWIssueResyncBucketBILog : public CLSRGWConcurrentIO {
protected:
- int issue_op(int shard_id, const string& oid);
+ int issue_op(int shard_id, const std::string& oid);
public:
- CLSRGWIssueResyncBucketBILog(librados::IoCtx& io_ctx, map<int, string>& _bucket_objs, uint32_t max_aio) :
+ CLSRGWIssueResyncBucketBILog(librados::IoCtx& io_ctx, std::map<int, std::string>& _bucket_objs, uint32_t max_aio) :
CLSRGWConcurrentIO(io_ctx, _bucket_objs, max_aio) {}
};
class CLSRGWIssueBucketBILogStop : public CLSRGWConcurrentIO {
protected:
- int issue_op(int shard_id, const string& oid);
+ int issue_op(int shard_id, const std::string& oid);
public:
- CLSRGWIssueBucketBILogStop(librados::IoCtx& io_ctx, map<int, string>& _bucket_objs, uint32_t max_aio) :
+ CLSRGWIssueBucketBILogStop(librados::IoCtx& io_ctx, std::map<int, std::string>& _bucket_objs, uint32_t max_aio) :
CLSRGWConcurrentIO(io_ctx, _bucket_objs, max_aio) {}
};
-int cls_rgw_get_dir_header_async(librados::IoCtx& io_ctx, string& oid, RGWGetDirHeader_CB *ctx);
+int cls_rgw_get_dir_header_async(librados::IoCtx& io_ctx, std::string& oid, RGWGetDirHeader_CB *ctx);
-void cls_rgw_encode_suggestion(char op, rgw_bucket_dir_entry& dirent, bufferlist& updates);
+void cls_rgw_encode_suggestion(char op, rgw_bucket_dir_entry& dirent, ceph::buffer::list& updates);
-void cls_rgw_suggest_changes(librados::ObjectWriteOperation& o, bufferlist& updates);
+void cls_rgw_suggest_changes(librados::ObjectWriteOperation& o, ceph::buffer::list& updates);
/* usage logging */
// these overloads which call io_ctx.operate() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_rgw_usage_log_read(librados::IoCtx& io_ctx, const string& oid, const string& user, const string& bucket,
- uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries, string& read_iter,
- map<rgw_user_bucket, rgw_usage_log_entry>& usage, bool *is_truncated);
+int cls_rgw_usage_log_read(librados::IoCtx& io_ctx, const std::string& oid, const std::string& user, const std::string& bucket,
+ uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries, std::string& read_iter,
+ std::map<rgw_user_bucket, rgw_usage_log_entry>& usage, bool *is_truncated);
#endif
-void cls_rgw_usage_log_trim(librados::ObjectWriteOperation& op, const string& user, const string& bucket, uint64_t start_epoch, uint64_t end_epoch);
+void cls_rgw_usage_log_trim(librados::ObjectWriteOperation& op, const std::string& user, const std::string& bucket, uint64_t start_epoch, uint64_t end_epoch);
void cls_rgw_usage_log_clear(librados::ObjectWriteOperation& op);
void cls_rgw_usage_log_add(librados::ObjectWriteOperation& op, rgw_usage_log_info& info);
/* garbage collection */
void cls_rgw_gc_set_entry(librados::ObjectWriteOperation& op, uint32_t expiration_secs, cls_rgw_gc_obj_info& info);
-void cls_rgw_gc_defer_entry(librados::ObjectWriteOperation& op, uint32_t expiration_secs, const string& tag);
-void cls_rgw_gc_remove(librados::ObjectWriteOperation& op, const vector<string>& tags);
+void cls_rgw_gc_defer_entry(librados::ObjectWriteOperation& op, uint32_t expiration_secs, const std::string& tag);
+void cls_rgw_gc_remove(librados::ObjectWriteOperation& op, const std::vector<std::string>& tags);
// these overloads which call io_ctx.operate() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_rgw_gc_list(librados::IoCtx& io_ctx, string& oid, string& marker, uint32_t max, bool expired_only,
- list<cls_rgw_gc_obj_info>& entries, bool *truncated, string& next_marker);
+int cls_rgw_gc_list(librados::IoCtx& io_ctx, std::string& oid, std::string& marker, uint32_t max, bool expired_only,
+ std::list<cls_rgw_gc_obj_info>& entries, bool *truncated, std::string& next_marker);
#endif
/* lifecycle */
// these overloads which call io_ctx.operate() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_rgw_lc_get_head(librados::IoCtx& io_ctx, const string& oid, cls_rgw_lc_obj_head& head);
-int cls_rgw_lc_put_head(librados::IoCtx& io_ctx, const string& oid, cls_rgw_lc_obj_head& head);
-int cls_rgw_lc_get_next_entry(librados::IoCtx& io_ctx, const string& oid, string& marker, pair<string, int>& entry);
-int cls_rgw_lc_rm_entry(librados::IoCtx& io_ctx, const string& oid, const pair<string, int>& entry);
-int cls_rgw_lc_set_entry(librados::IoCtx& io_ctx, const string& oid, const pair<string, int>& entry);
-int cls_rgw_lc_get_entry(librados::IoCtx& io_ctx, const string& oid, const std::string& marker, rgw_lc_entry_t& entry);
-int cls_rgw_lc_list(librados::IoCtx& io_ctx, const string& oid,
- const string& marker,
+int cls_rgw_lc_get_head(librados::IoCtx& io_ctx, const std::string& oid, cls_rgw_lc_obj_head& head);
+int cls_rgw_lc_put_head(librados::IoCtx& io_ctx, const std::string& oid, cls_rgw_lc_obj_head& head);
+int cls_rgw_lc_get_next_entry(librados::IoCtx& io_ctx, const std::string& oid, std::string& marker, std::pair<std::string, int>& entry);
+int cls_rgw_lc_rm_entry(librados::IoCtx& io_ctx, const std::string& oid, const std::pair<std::string, int>& entry);
+int cls_rgw_lc_set_entry(librados::IoCtx& io_ctx, const std::string& oid, const std::pair<std::string, int>& entry);
+int cls_rgw_lc_get_entry(librados::IoCtx& io_ctx, const std::string& oid, const std::string& marker, rgw_lc_entry_t& entry);
+int cls_rgw_lc_list(librados::IoCtx& io_ctx, const std::string& oid,
+ const std::string& marker,
uint32_t max_entries,
- map<string, int>& entries);
+ std::map<std::string, int>& entries);
#endif
/* resharding */
// these overloads which call io_ctx.operate() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_rgw_reshard_list(librados::IoCtx& io_ctx, const string& oid, string& marker, uint32_t max,
- list<cls_rgw_reshard_entry>& entries, bool* is_truncated);
-int cls_rgw_reshard_get(librados::IoCtx& io_ctx, const string& oid, cls_rgw_reshard_entry& entry);
+int cls_rgw_reshard_list(librados::IoCtx& io_ctx, const std::string& oid, std::string& marker, uint32_t max,
+ std::list<cls_rgw_reshard_entry>& entries, bool* is_truncated);
+int cls_rgw_reshard_get(librados::IoCtx& io_ctx, const std::string& oid, cls_rgw_reshard_entry& entry);
#endif
/* resharding attribute on bucket index shard headers */
// these overloads which call io_ctx.operate() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_rgw_set_bucket_resharding(librados::IoCtx& io_ctx, const string& oid,
+int cls_rgw_set_bucket_resharding(librados::IoCtx& io_ctx, const std::string& oid,
const cls_rgw_bucket_instance_entry& entry);
-int cls_rgw_clear_bucket_resharding(librados::IoCtx& io_ctx, const string& oid);
-int cls_rgw_get_bucket_resharding(librados::IoCtx& io_ctx, const string& oid,
+int cls_rgw_clear_bucket_resharding(librados::IoCtx& io_ctx, const std::string& oid);
+int cls_rgw_get_bucket_resharding(librados::IoCtx& io_ctx, const std::string& oid,
cls_rgw_bucket_instance_entry *entry);
#endif
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_CLS_RGW_CONST_H
#include "common/ceph_json.h"
#include "include/utime.h"
+using std::list;
+using std::map;
+
+using ceph::Formatter;
+
void rgw_cls_tag_timeout_op::dump(Formatter *f) const
{
f->dump_int("tag_timeout", tag_timeout);
f->dump_string("locator", locator);
f->dump_bool("log_op", log_op);
f->dump_int("bilog_flags", bilog_flags);
- ::encode_json("zones_trace", zones_trace, f);
+ encode_json("zones_trace", zones_trace, f);
}
void rgw_cls_obj_complete_op::generate_test_instances(list<rgw_cls_obj_complete_op*>& o)
list<rgw_bucket_dir_entry_meta *> l;
rgw_bucket_dir_entry_meta::generate_test_instances(l);
- list<rgw_bucket_dir_entry_meta *>::iterator iter = l.begin();
+ auto iter = l.begin();
op->meta = *(*iter);
o.push_back(op);
f->dump_string("tag", tag);
f->dump_bool("log_op", log_op);
f->dump_int("bilog_flags", bilog_flags);
- ::encode_json("zones_trace", zones_trace, f);
+ encode_json("zones_trace", zones_trace, f);
}
void rgw_cls_link_olh_op::generate_test_instances(list<rgw_cls_link_olh_op*>& o)
op->olh_epoch = 123;
list<rgw_bucket_dir_entry_meta *> l;
rgw_bucket_dir_entry_meta::generate_test_instances(l);
- list<rgw_bucket_dir_entry_meta *>::iterator iter = l.begin();
+ auto iter = l.begin();
op->meta = *(*iter);
op->log_op = true;
void rgw_cls_link_olh_op::dump(Formatter *f) const
{
- ::encode_json("key", key, f);
- ::encode_json("olh_tag", olh_tag, f);
- ::encode_json("delete_marker", delete_marker, f);
- ::encode_json("op_tag", op_tag, f);
- ::encode_json("meta", meta, f);
- ::encode_json("olh_epoch", olh_epoch, f);
- ::encode_json("log_op", log_op, f);
- ::encode_json("bilog_flags", (uint32_t)bilog_flags, f);
+ encode_json("key", key, f);
+ encode_json("olh_tag", olh_tag, f);
+ encode_json("delete_marker", delete_marker, f);
+ encode_json("op_tag", op_tag, f);
+ encode_json("meta", meta, f);
+ encode_json("olh_epoch", olh_epoch, f);
+ encode_json("log_op", log_op, f);
+ encode_json("bilog_flags", (uint32_t)bilog_flags, f);
utime_t ut(unmod_since);
- ::encode_json("unmod_since", ut, f);
- ::encode_json("high_precision_time", high_precision_time, f);
- ::encode_json("zones_trace", zones_trace, f);
+ encode_json("unmod_since", ut, f);
+ encode_json("high_precision_time", high_precision_time, f);
+ encode_json("zones_trace", zones_trace, f);
}
void rgw_cls_unlink_instance_op::generate_test_instances(list<rgw_cls_unlink_instance_op*>& o)
void rgw_cls_unlink_instance_op::dump(Formatter *f) const
{
- ::encode_json("key", key, f);
- ::encode_json("op_tag", op_tag, f);
- ::encode_json("olh_epoch", olh_epoch, f);
- ::encode_json("log_op", log_op, f);
- ::encode_json("bilog_flags", (uint32_t)bilog_flags, f);
- ::encode_json("zones_trace", zones_trace, f);
+ encode_json("key", key, f);
+ encode_json("op_tag", op_tag, f);
+ encode_json("olh_epoch", olh_epoch, f);
+ encode_json("log_op", log_op, f);
+ encode_json("bilog_flags", (uint32_t)bilog_flags, f);
+ encode_json("zones_trace", zones_trace, f);
}
void rgw_cls_read_olh_log_op::generate_test_instances(list<rgw_cls_read_olh_log_op*>& o)
void rgw_cls_read_olh_log_op::dump(Formatter *f) const
{
- ::encode_json("olh", olh, f);
- ::encode_json("ver_marker", ver_marker, f);
- ::encode_json("olh_tag", olh_tag, f);
+ encode_json("olh", olh, f);
+ encode_json("ver_marker", ver_marker, f);
+ encode_json("olh_tag", olh_tag, f);
}
void rgw_cls_read_olh_log_ret::generate_test_instances(list<rgw_cls_read_olh_log_ret*>& o)
r->is_truncated = true;
list<rgw_bucket_olh_log_entry *> l;
rgw_bucket_olh_log_entry::generate_test_instances(l);
- list<rgw_bucket_olh_log_entry *>::iterator iter = l.begin();
+ auto iter = l.begin();
r->log[1].push_back(*(*iter));
o.push_back(r);
void rgw_cls_read_olh_log_ret::dump(Formatter *f) const
{
- ::encode_json("log", log, f);
- ::encode_json("is_truncated", is_truncated, f);
+ encode_json("log", log, f);
+ encode_json("is_truncated", is_truncated, f);
}
void rgw_cls_trim_olh_log_op::generate_test_instances(list<rgw_cls_trim_olh_log_op*>& o)
void rgw_cls_trim_olh_log_op::dump(Formatter *f) const
{
- ::encode_json("olh", olh, f);
- ::encode_json("ver", ver, f);
- ::encode_json("olh_tag", olh_tag, f);
+ encode_json("olh", olh, f);
+ encode_json("ver", ver, f);
+ encode_json("olh_tag", olh_tag, f);
}
void rgw_cls_bucket_clear_olh_op::generate_test_instances(list<rgw_cls_bucket_clear_olh_op *>& o)
void rgw_cls_bucket_clear_olh_op::dump(Formatter *f) const
{
- ::encode_json("key", key, f);
- ::encode_json("olh_tag", olh_tag, f);
+ encode_json("key", key, f);
+ encode_json("olh_tag", olh_tag, f);
}
void rgw_cls_list_op::generate_test_instances(list<rgw_cls_list_op*>& o)
{
list<rgw_bucket_dir *> l;
rgw_bucket_dir::generate_test_instances(l);
- list<rgw_bucket_dir *>::iterator iter;
- for (iter = l.begin(); iter != l.end(); ++iter) {
+ for (auto iter = l.begin(); iter != l.end(); ++iter) {
rgw_bucket_dir *d = *iter;
rgw_cls_list_ret *ret = new rgw_cls_list_ret;
r->calculated_header = *(h.front());
o.push_back(r);
- for (list<rgw_bucket_dir_header *>::iterator iter = h.begin(); iter != h.end(); ++iter) {
+ for (auto iter = h.begin(); iter != h.end(); ++iter) {
delete *iter;
}
o.push_back(new rgw_cls_check_index_ret);
void rgw_cls_check_index_ret::dump(Formatter *f) const
{
- ::encode_json("existing_header", existing_header, f);
- ::encode_json("calculated_header", calculated_header, f);
+ encode_json("existing_header", existing_header, f);
+ encode_json("calculated_header", calculated_header, f);
}
void rgw_cls_bucket_update_stats_op::generate_test_instances(list<rgw_cls_bucket_update_stats_op*>& o)
void rgw_cls_bucket_update_stats_op::dump(Formatter *f) const
{
- ::encode_json("absolute", absolute, f);
+ encode_json("absolute", absolute, f);
map<int, rgw_bucket_category_stats> s;
for (auto& entry : stats) {
s[(int)entry.first] = entry.second;
}
- ::encode_json("stats", s, f);
+ encode_json("stats", s, f);
}
void cls_rgw_bi_log_list_op::dump(Formatter *f) const
ls.push_back(new cls_rgw_reshard_add_op);
list<cls_rgw_reshard_entry *> l;
cls_rgw_reshard_entry::generate_test_instances(l);
- list<cls_rgw_reshard_entry *>::iterator iter = l.begin();
+ auto iter = l.begin();
ls.back()->entry = *(*iter);
}
void cls_rgw_reshard_add_op::dump(Formatter *f) const
{
- ::encode_json("entry", entry, f);
+ encode_json("entry", entry, f);
}
void cls_rgw_reshard_list_op::generate_test_instances(list<cls_rgw_reshard_list_op*>& ls)
void cls_rgw_reshard_list_op::dump(Formatter *f) const
{
- ::encode_json("max", max, f);
- ::encode_json("marker", marker, f);
+ encode_json("max", max, f);
+ encode_json("marker", marker, f);
}
void cls_rgw_reshard_list_ret::generate_test_instances(list<cls_rgw_reshard_list_ret*>& ls)
void cls_rgw_reshard_list_ret::dump(Formatter *f) const
{
- ::encode_json("entries", entries, f);
- ::encode_json("is_truncated", is_truncated, f);
+ encode_json("entries", entries, f);
+ encode_json("is_truncated", is_truncated, f);
}
void cls_rgw_reshard_get_op::generate_test_instances(list<cls_rgw_reshard_get_op*>& ls)
void cls_rgw_reshard_get_op::dump(Formatter *f) const
{
- ::encode_json("entry", entry, f);
+ encode_json("entry", entry, f);
}
void cls_rgw_reshard_get_ret::generate_test_instances(list<cls_rgw_reshard_get_ret*>& ls)
void cls_rgw_reshard_get_ret::dump(Formatter *f) const
{
- ::encode_json("entry", entry, f);
+ encode_json("entry", entry, f);
}
void cls_rgw_reshard_remove_op::generate_test_instances(list<cls_rgw_reshard_remove_op*>& ls)
void cls_rgw_reshard_remove_op::dump(Formatter *f) const
{
- ::encode_json("bucket_name", bucket_name, f);
- ::encode_json("bucket_id", bucket_name, f);
+ encode_json("bucket_name", bucket_name, f);
+ encode_json("bucket_id", bucket_name, f);
}
void cls_rgw_set_bucket_resharding_op::dump(Formatter *f) const
{
- ::encode_json("entry", entry, f);
+ encode_json("entry", entry, f);
}
void cls_rgw_clear_bucket_resharding_op::generate_test_instances(
void cls_rgw_guard_bucket_resharding_op::dump(Formatter *f) const
{
- ::encode_json("ret_err", ret_err, f);
+ encode_json("ret_err", ret_err, f);
}
rgw_cls_tag_timeout_op() : tag_timeout(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(tag_timeout, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(tag_timeout, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_cls_tag_timeout_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_tag_timeout_op*>& ls);
};
WRITE_CLASS_ENCODER(rgw_cls_tag_timeout_op)
{
RGWModifyOp op;
cls_rgw_obj_key key;
- string tag;
- string locator;
+ std::string tag;
+ std::string locator;
bool log_op;
uint16_t bilog_flags;
rgw_zone_set zones_trace;
rgw_cls_obj_prepare_op() : op(CLS_RGW_OP_UNKNOWN), log_op(false), bilog_flags(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(7, 5, bl);
uint8_t c = (uint8_t)op;
encode(c, bl);
encode(zones_trace, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(7, 3, 3, bl);
uint8_t c;
decode(c, bl);
}
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_cls_obj_prepare_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_obj_prepare_op*>& o);
};
WRITE_CLASS_ENCODER(rgw_cls_obj_prepare_op)
{
RGWModifyOp op;
cls_rgw_obj_key key;
- string locator;
+ std::string locator;
rgw_bucket_entry_ver ver;
rgw_bucket_dir_entry_meta meta;
- string tag;
+ std::string tag;
bool log_op;
uint16_t bilog_flags;
- list<cls_rgw_obj_key> remove_objs;
+ std::list<cls_rgw_obj_key> remove_objs;
rgw_zone_set zones_trace;
rgw_cls_obj_complete_op() : op(CLS_RGW_OP_ADD), log_op(false), bilog_flags(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(9, 7, bl);
uint8_t c = (uint8_t)op;
encode(c, bl);
encode(zones_trace, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(9, 3, 3, bl);
uint8_t c;
decode(c, bl);
decode(locator, bl);
}
if (struct_v >= 4 && struct_v < 7) {
- list<string> old_remove_objs;
+ std::list<std::string> old_remove_objs;
decode(old_remove_objs, bl);
- for (list<string>::iterator iter = old_remove_objs.begin();
+ for (auto iter = old_remove_objs.begin();
iter != old_remove_objs.end(); ++iter) {
cls_rgw_obj_key k;
k.name = *iter;
}
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_cls_obj_complete_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_obj_complete_op*>& o);
};
WRITE_CLASS_ENCODER(rgw_cls_obj_complete_op)
struct rgw_cls_link_olh_op {
cls_rgw_obj_key key;
- string olh_tag;
+ std::string olh_tag;
bool delete_marker;
- string op_tag;
+ std::string op_tag;
rgw_bucket_dir_entry_meta meta;
uint64_t olh_epoch;
bool log_op;
uint16_t bilog_flags;
- real_time unmod_since; /* only create delete marker if newer then this */
+ ceph::real_time unmod_since; /* only create delete marker if newer then this */
bool high_precision_time;
rgw_zone_set zones_trace;
rgw_cls_link_olh_op() : delete_marker(false), olh_epoch(0), log_op(false), bilog_flags(0), high_precision_time(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(5, 1, bl);
encode(key, bl);
encode(olh_tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(5, bl);
decode(key, bl);
decode(olh_tag, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<rgw_cls_link_olh_op *>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_link_olh_op *>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(rgw_cls_link_olh_op)
struct rgw_cls_unlink_instance_op {
cls_rgw_obj_key key;
- string op_tag;
+ std::string op_tag;
uint64_t olh_epoch;
bool log_op;
uint16_t bilog_flags;
- string olh_tag;
+ std::string olh_tag;
rgw_zone_set zones_trace;
rgw_cls_unlink_instance_op() : olh_epoch(0), log_op(false), bilog_flags(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(3, 1, bl);
encode(key, bl);
encode(op_tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(3, bl);
decode(key, bl);
decode(op_tag, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<rgw_cls_unlink_instance_op *>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_unlink_instance_op *>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(rgw_cls_unlink_instance_op)
{
cls_rgw_obj_key olh;
uint64_t ver_marker;
- string olh_tag;
+ std::string olh_tag;
rgw_cls_read_olh_log_op() : ver_marker(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(olh, bl);
encode(ver_marker, bl);
encode(olh_tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(olh, bl);
decode(ver_marker, bl);
decode(olh_tag, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<rgw_cls_read_olh_log_op *>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_read_olh_log_op *>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_op)
struct rgw_cls_read_olh_log_ret
{
- map<uint64_t, vector<rgw_bucket_olh_log_entry> > log;
+ std::map<uint64_t, std::vector<rgw_bucket_olh_log_entry> > log;
bool is_truncated;
rgw_cls_read_olh_log_ret() : is_truncated(false) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(log, bl);
encode(is_truncated, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(log, bl);
decode(is_truncated, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<rgw_cls_read_olh_log_ret *>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_read_olh_log_ret *>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_ret)
{
cls_rgw_obj_key olh;
uint64_t ver;
- string olh_tag;
+ std::string olh_tag;
rgw_cls_trim_olh_log_op() : ver(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(olh, bl);
encode(ver, bl);
encode(olh_tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(olh, bl);
decode(ver, bl);
decode(olh_tag, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<rgw_cls_trim_olh_log_op *>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_trim_olh_log_op *>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(rgw_cls_trim_olh_log_op)
struct rgw_cls_bucket_clear_olh_op {
cls_rgw_obj_key key;
- string olh_tag;
+ std::string olh_tag;
rgw_cls_bucket_clear_olh_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(key, bl);
encode(olh_tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(key, bl);
decode(olh_tag, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<rgw_cls_bucket_clear_olh_op *>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_bucket_clear_olh_op *>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(rgw_cls_bucket_clear_olh_op)
{
cls_rgw_obj_key start_obj;
uint32_t num_entries;
- string filter_prefix;
+ std::string filter_prefix;
bool list_versions;
- string delimiter;
+ std::string delimiter;
rgw_cls_list_op() : num_entries(0), list_versions(false) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(6, 4, bl);
encode(num_entries, bl);
encode(filter_prefix, bl);
encode(delimiter, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, bl);
if (struct_v < 4) {
decode(start_obj.name, bl);
}
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_cls_list_op*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_list_op*>& o);
};
WRITE_CLASS_ENCODER(rgw_cls_list_op)
cls_filtered(true)
{}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(3, 2, bl);
encode(dir, bl);
encode(is_truncated, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
decode(dir, bl);
decode(is_truncated, bl);
cls_filtered = struct_v >= 3;
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_cls_list_ret*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_list_ret*>& o);
};
WRITE_CLASS_ENCODER(rgw_cls_list_ret)
rgw_cls_check_index_ret() {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(existing_header, bl);
encode(calculated_header, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(existing_header, bl);
decode(calculated_header, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_cls_check_index_ret *>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_check_index_ret *>& o);
};
WRITE_CLASS_ENCODER(rgw_cls_check_index_ret)
struct rgw_cls_bucket_update_stats_op
{
bool absolute{false};
- map<RGWObjCategory, rgw_bucket_category_stats> stats;
+ std::map<RGWObjCategory, rgw_bucket_category_stats> stats;
rgw_cls_bucket_update_stats_op() {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(absolute, bl);
encode(stats, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(absolute, bl);
decode(stats, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_cls_bucket_update_stats_op *>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_cls_bucket_update_stats_op *>& o);
};
WRITE_CLASS_ENCODER(rgw_cls_bucket_update_stats_op)
struct rgw_cls_obj_remove_op {
- list<string> keep_attr_prefixes;
+ std::list<std::string> keep_attr_prefixes;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(keep_attr_prefixes, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(keep_attr_prefixes, bl);
DECODE_FINISH(bl);
WRITE_CLASS_ENCODER(rgw_cls_obj_remove_op)
struct rgw_cls_obj_store_pg_ver_op {
- string attr;
+ std::string attr;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(attr, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(attr, bl);
DECODE_FINISH(bl);
WRITE_CLASS_ENCODER(rgw_cls_obj_store_pg_ver_op)
struct rgw_cls_obj_check_attrs_prefix {
- string check_prefix;
+ std::string check_prefix;
bool fail_if_exist;
rgw_cls_obj_check_attrs_prefix() : fail_if_exist(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(check_prefix, bl);
encode(fail_if_exist, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(check_prefix, bl);
decode(fail_if_exist, bl);
rgw_cls_obj_check_mtime() : type(CLS_RGW_CHECK_TIME_MTIME_EQ), high_precision_time(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(mtime, bl);
encode((uint8_t)type, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(mtime, bl);
uint8_t c;
rgw_usage_log_info info;
rgw_user user;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(info, bl);
encode(user.to_str(), bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(info, bl);
if (struct_v >= 2) {
- string s;
+ std::string s;
decode(s, bl);
user.from_str(s);
}
rgw_cls_bi_get_op() : type(BIIndexType::Plain) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(key, bl);
encode((uint8_t)type, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(key, bl);
uint8_t c;
rgw_cls_bi_get_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
rgw_cls_bi_put_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
struct rgw_cls_bi_list_op {
uint32_t max;
- string name;
- string marker;
+ std::string name;
+ std::string marker;
rgw_cls_bi_list_op() : max(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(max, bl);
encode(name, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(max, bl);
decode(name, bl);
WRITE_CLASS_ENCODER(rgw_cls_bi_list_op)
struct rgw_cls_bi_list_ret {
- list<rgw_cls_bi_entry> entries;
+ std::list<rgw_cls_bi_entry> entries;
bool is_truncated;
rgw_cls_bi_list_ret() : is_truncated(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
encode(is_truncated, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
decode(is_truncated, bl);
struct rgw_cls_usage_log_read_op {
uint64_t start_epoch;
uint64_t end_epoch;
- string owner;
- string bucket;
+ std::string owner;
+ std::string bucket;
- string iter; // should be empty for the first call, non empty for subsequent calls
+ std::string iter; // should be empty for the first call, non empty for subsequent calls
uint32_t max_entries;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(start_epoch, bl);
encode(end_epoch, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(start_epoch, bl);
decode(end_epoch, bl);
WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_op)
struct rgw_cls_usage_log_read_ret {
- map<rgw_user_bucket, rgw_usage_log_entry> usage;
+ std::map<rgw_user_bucket, rgw_usage_log_entry> usage;
bool truncated;
- string next_iter;
+ std::string next_iter;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(usage, bl);
encode(truncated, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(usage, bl);
decode(truncated, bl);
struct rgw_cls_usage_log_trim_op {
uint64_t start_epoch;
uint64_t end_epoch;
- string user;
- string bucket;
+ std::string user;
+ std::string bucket;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(3, 2, bl);
encode(start_epoch, bl);
encode(end_epoch, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(3, bl);
decode(start_epoch, bl);
decode(end_epoch, bl);
cls_rgw_gc_obj_info info;
cls_rgw_gc_set_entry_op() : expiration_secs(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(expiration_secs, bl);
encode(info, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(expiration_secs, bl);
decode(info, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_gc_set_entry_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_gc_set_entry_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_gc_set_entry_op)
struct cls_rgw_gc_defer_entry_op {
uint32_t expiration_secs;
- string tag;
+ std::string tag;
cls_rgw_gc_defer_entry_op() : expiration_secs(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(expiration_secs, bl);
encode(tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(expiration_secs, bl);
decode(tag, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_gc_defer_entry_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_gc_defer_entry_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_gc_defer_entry_op)
struct cls_rgw_gc_list_op {
- string marker;
+ std::string marker;
uint32_t max;
bool expired_only;
cls_rgw_gc_list_op() : max(0), expired_only(true) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(marker, bl);
encode(max, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(marker, bl);
decode(max, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_gc_list_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_gc_list_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_gc_list_op)
struct cls_rgw_gc_list_ret {
- list<cls_rgw_gc_obj_info> entries;
- string next_marker;
+ std::list<cls_rgw_gc_obj_info> entries;
+ std::string next_marker;
bool truncated;
cls_rgw_gc_list_ret() : truncated(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(entries, bl);
encode(next_marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(entries, bl);
if (struct_v >= 2)
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_gc_list_ret*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_gc_list_ret*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_gc_list_ret)
struct cls_rgw_gc_remove_op {
- vector<string> tags;
+ std::vector<std::string> tags;
cls_rgw_gc_remove_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(tags, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(tags, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_gc_remove_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_gc_remove_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_gc_remove_op)
struct cls_rgw_bi_log_list_op {
- string marker;
+ std::string marker;
uint32_t max;
cls_rgw_bi_log_list_op() : max(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(marker, bl);
encode(max, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(marker, bl);
decode(max, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_bi_log_list_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_bi_log_list_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_op)
struct cls_rgw_bi_log_trim_op {
- string start_marker;
- string end_marker;
+ std::string start_marker;
+ std::string end_marker;
cls_rgw_bi_log_trim_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(start_marker, bl);
encode(end_marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(start_marker, bl);
decode(end_marker, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_bi_log_trim_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_bi_log_trim_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_bi_log_trim_op)
struct cls_rgw_bi_log_list_ret {
- list<rgw_bi_log_entry> entries;
+ std::list<rgw_bi_log_entry> entries;
bool truncated;
cls_rgw_bi_log_list_ret() : truncated(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
encode(truncated, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
decode(truncated, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_bi_log_list_ret*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_bi_log_list_ret*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_ret)
struct cls_rgw_lc_get_next_entry_op {
- string marker;
+ std::string marker;
cls_rgw_lc_get_next_entry_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(marker, bl);
DECODE_FINISH(bl);
rgw_lc_entry_t entry;
cls_rgw_lc_get_next_entry_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
WRITE_CLASS_ENCODER(cls_rgw_lc_get_next_entry_ret)
struct cls_rgw_lc_get_entry_op {
- string marker;
+ std::string marker;
cls_rgw_lc_get_entry_op() {}
cls_rgw_lc_get_entry_op(const std::string& _marker) : marker(_marker) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(marker, bl);
DECODE_FINISH(bl);
cls_rgw_lc_get_entry_ret() {}
cls_rgw_lc_get_entry_ret(rgw_lc_entry_t&& _entry) : entry(std::move(_entry)) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
rgw_lc_entry_t entry;
cls_rgw_lc_rm_entry_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
rgw_lc_entry_t entry;
cls_rgw_lc_set_entry_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
cls_rgw_lc_put_head_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(head, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(head, bl);
DECODE_FINISH(bl);
cls_rgw_lc_get_head_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(head, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(head, bl);
DECODE_FINISH(bl);
WRITE_CLASS_ENCODER(cls_rgw_lc_get_head_ret)
struct cls_rgw_lc_list_entries_op {
- string marker;
+ std::string marker;
uint32_t max_entries = 0;
cls_rgw_lc_list_entries_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(marker, bl);
encode(max_entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(marker, bl);
decode(max_entries, bl);
WRITE_CLASS_ENCODER(cls_rgw_lc_list_entries_op)
struct cls_rgw_lc_list_entries_ret {
- map<string, int> entries;
+ std::map<std::string, int> entries;
bool is_truncated{false};
cls_rgw_lc_list_entries_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(entries, bl);
encode(is_truncated, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(entries, bl);
if (struct_v >= 2) {
cls_rgw_reshard_add_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_reshard_add_op*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_reshard_add_op*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_reshard_add_op)
struct cls_rgw_reshard_list_op {
uint32_t max{0};
- string marker;
+ std::string marker;
cls_rgw_reshard_list_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(max, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(max, bl);
decode(marker, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_reshard_list_op*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_reshard_list_op*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_reshard_list_op)
struct cls_rgw_reshard_list_ret {
- list<cls_rgw_reshard_entry> entries;
+ std::list<cls_rgw_reshard_entry> entries;
bool is_truncated{false};
cls_rgw_reshard_list_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
encode(is_truncated, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
decode(is_truncated, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_reshard_list_ret*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_reshard_list_ret*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_reshard_list_ret)
cls_rgw_reshard_get_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_reshard_get_op*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_reshard_get_op*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_reshard_get_op)
cls_rgw_reshard_get_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_reshard_get_ret*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_reshard_get_ret*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_reshard_get_ret)
struct cls_rgw_reshard_remove_op {
- string tenant;
- string bucket_name;
- string bucket_id;
+ std::string tenant;
+ std::string bucket_name;
+ std::string bucket_id;
cls_rgw_reshard_remove_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(tenant, bl);
encode(bucket_name, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(tenant, bl);
decode(bucket_name, bl);
decode(bucket_id, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_reshard_remove_op*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_reshard_remove_op*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_reshard_remove_op)
struct cls_rgw_set_bucket_resharding_op {
cls_rgw_bucket_instance_entry entry;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entry, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entry, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_set_bucket_resharding_op*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_set_bucket_resharding_op*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_set_bucket_resharding_op)
struct cls_rgw_clear_bucket_resharding_op {
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_clear_bucket_resharding_op*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_clear_bucket_resharding_op*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_clear_bucket_resharding_op)
struct cls_rgw_guard_bucket_resharding_op {
int ret_err{0};
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(ret_err, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(ret_err, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_guard_bucket_resharding_op*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_guard_bucket_resharding_op*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_guard_bucket_resharding_op)
struct cls_rgw_get_bucket_resharding_op {
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_get_bucket_resharding_op*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_get_bucket_resharding_op*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_get_bucket_resharding_op)
struct cls_rgw_get_bucket_resharding_ret {
cls_rgw_bucket_instance_entry new_instance;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(new_instance, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(new_instance, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<cls_rgw_get_bucket_resharding_ret*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_get_bucket_resharding_ret*>& o);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(cls_rgw_get_bucket_resharding_ret)
#include "common/ceph_json.h"
#include "include/utime.h"
+using std::list;
+using std::string;
+
+using ceph::bufferlist;
+using ceph::Formatter;
void rgw_zone_set_entry::from_str(const string& s)
{
void rgw_zone_set_entry::encode(bufferlist &bl) const
{
/* no ENCODE_START, ENCODE_END for backward compatibility */
- ceph::encode(to_str(), bl);
+ ceph::encode(to_str(), bl);
}
void rgw_zone_set_entry::decode(bufferlist::const_iterator &bl)
list<rgw_bucket_dir_entry_meta *> l;
rgw_bucket_dir_entry_meta::generate_test_instances(l);
- list<rgw_bucket_dir_entry_meta *>::iterator iter;
- for (iter = l.begin(); iter != l.end(); ++iter) {
+ for (auto iter = l.begin(); iter != l.end(); ++iter) {
rgw_bucket_dir_entry_meta *m = *iter;
rgw_bucket_dir_entry *e = new rgw_bucket_dir_entry;
e->key.name = "name";
void rgw_bucket_dir_header::generate_test_instances(list<rgw_bucket_dir_header*>& o)
{
list<rgw_bucket_category_stats *> l;
- list<rgw_bucket_category_stats *>::iterator iter;
rgw_bucket_category_stats::generate_test_instances(l);
- uint8_t i;
- for (i = 0, iter = l.begin(); iter != l.end(); ++iter, ++i) {
+ uint8_t i = 0;
+ for (auto iter = l.begin(); iter != l.end(); ++iter, ++i) {
RGWObjCategory c = static_cast<RGWObjCategory>(i);
rgw_bucket_dir_header *h = new rgw_bucket_dir_header;
rgw_bucket_category_stats *s = *iter;
void rgw_bucket_dir::generate_test_instances(list<rgw_bucket_dir*>& o)
{
list<rgw_bucket_dir_header *> l;
- list<rgw_bucket_dir_header *>::iterator iter;
rgw_bucket_dir_header::generate_test_instances(l);
- uint8_t i;
- for (i = 0, iter = l.begin(); iter != l.end(); ++iter, ++i) {
+ uint8_t i = 0;
+ for (auto iter = l.begin(); iter != l.end(); ++iter, ++i) {
rgw_bucket_dir *d = new rgw_bucket_dir;
rgw_bucket_dir_header *h = *iter;
d->header = *h;
list<rgw_bucket_dir_entry *> el;
- list<rgw_bucket_dir_entry *>::iterator eiter;
- for (eiter = el.begin(); eiter != el.end(); ++eiter) {
+ for (auto eiter = el.begin(); eiter != el.end(); ++eiter) {
rgw_bucket_dir_entry *e = *eiter;
d->m[e->key.name] = *e;
f->open_array_section("categories");
if (usage_map.size() > 0) {
- map<string, rgw_usage_data>::const_iterator it;
- for (it = usage_map.begin(); it != usage_map.end(); it++) {
+ for (auto it = usage_map.begin(); it != usage_map.end(); it++) {
const rgw_usage_data& total_usage = it->second;
f->open_object_section("entry");
f->dump_string("category", it->first.c_str());
class JSONObj;
-namespace ceph {
- class Formatter;
-}
using ceph::operator <<;
struct rgw_zone_set_entry {
- string zone;
+ std::string zone;
std::optional<std::string> location_key;
bool operator<(const rgw_zone_set_entry& e) const {
}
rgw_zone_set_entry() {}
- rgw_zone_set_entry(const string& _zone,
+ rgw_zone_set_entry(const std::string& _zone,
std::optional<std::string> _location_key) : zone(_zone),
location_key(_location_key) {}
- rgw_zone_set_entry(const string& s) {
+ rgw_zone_set_entry(const std::string& s) {
from_str(s);
}
- void from_str(const string& s);
- string to_str() const;
+ void from_str(const std::string& s);
+ std::string to_str() const;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
};
WRITE_CLASS_ENCODER(rgw_zone_set_entry)
struct rgw_zone_set {
std::set<rgw_zone_set_entry> entries;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
/* no ENCODE_START, ENCODE_END for backward compatibility */
ceph::encode(entries, bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
/* no DECODE_START, DECODE_END for backward compatibility */
ceph::decode(entries, bl);
}
- void insert(const string& zone, std::optional<string> location_key);
- bool exists(const string& zone, std::optional<string> location_key) const;
+ void insert(const std::string& zone, std::optional<std::string> location_key);
+ bool exists(const std::string& zone, std::optional<std::string> location_key) const;
};
WRITE_CLASS_ENCODER(rgw_zone_set)
#define ROUND_BLOCK_SIZE 4096
-static inline uint64_t cls_rgw_get_rounded_size(uint64_t size) {
+inline uint64_t cls_rgw_get_rounded_size(uint64_t size) {
return (size + ROUND_BLOCK_SIZE - 1) & ~(ROUND_BLOCK_SIZE - 1);
}
/*
- * This takes a string that either wholly contains a delimiter or is a
+ * This takes a std::string that either wholly contains a delimiter or is a
* path that ends with a delimiter and appends a new character to the
* end such that when a we request bucket-index entries *after* this,
* we'll get the next object after the "subdirectory". This works
* because we append a '\xFF' charater, and no valid UTF-8 character
* can contain that byte, so no valid entries can be skipped.
*/
-static inline std::string cls_rgw_after_delim(const std::string& path) {
+inline std::string cls_rgw_after_delim(const std::string& path) {
// assert: ! path.empty()
return path + '\xFF';
}
rgw_bucket_pending_info() : state(CLS_RGW_STATE_PENDING_MODIFY), op(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(2, 2, bl);
uint8_t s = (uint8_t)state;
encode(s, bl);
encode(op, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
uint8_t s;
decode(s, bl);
decode(op, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
- static void generate_test_instances(list<rgw_bucket_pending_info*>& o);
+ static void generate_test_instances(std::list<rgw_bucket_pending_info*>& o);
};
WRITE_CLASS_ENCODER(rgw_bucket_pending_info)
RGWObjCategory category;
uint64_t size;
ceph::real_time mtime;
- string etag;
- string owner;
- string owner_display_name;
- string content_type;
+ std::string etag;
+ std::string owner;
+ std::string owner_display_name;
+ std::string content_type;
uint64_t accounted_size;
- string user_data;
- string storage_class;
+ std::string user_data;
+ std::string storage_class;
bool appendable;
rgw_bucket_dir_entry_meta() :
category(RGWObjCategory::None), size(0), accounted_size(0), appendable(false) { }
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(7, 3, bl);
encode(category, bl);
encode(size, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(6, 3, 3, bl);
decode(category, bl);
decode(size, bl);
decode(appendable, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
- static void generate_test_instances(list<rgw_bucket_dir_entry_meta*>& o);
+ static void generate_test_instances(std::list<rgw_bucket_dir_entry_meta*>& o);
};
WRITE_CLASS_ENCODER(rgw_bucket_dir_entry_meta)
template<class T>
-void encode_packed_val(T val, bufferlist& bl)
+void encode_packed_val(T val, ceph::buffer::list& bl)
{
using ceph::encode;
if ((uint64_t)val < 0x80) {
}
template<class T>
-void decode_packed_val(T& val, bufferlist::const_iterator& bl)
+void decode_packed_val(T& val, ceph::buffer::list::const_iterator& bl)
{
using ceph::decode;
unsigned char c;
}
break;
default:
- throw buffer::error();
+ throw ceph::buffer::error();
}
}
rgw_bucket_entry_ver() : pool(-1), epoch(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode_packed_val(pool, bl);
encode_packed_val(epoch, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode_packed_val(pool, bl);
decode_packed_val(epoch, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
- static void generate_test_instances(list<rgw_bucket_entry_ver*>& o);
+ static void generate_test_instances(std::list<rgw_bucket_entry_ver*>& o);
};
WRITE_CLASS_ENCODER(rgw_bucket_entry_ver)
struct cls_rgw_obj_key {
- string name;
- string instance;
+ std::string name;
+ std::string instance;
cls_rgw_obj_key() {}
- cls_rgw_obj_key(const string &_name) : name(_name) {}
- cls_rgw_obj_key(const string& n, const string& i) : name(n), instance(i) {}
+ cls_rgw_obj_key(const std::string &_name) : name(_name) {}
+ cls_rgw_obj_key(const std::string& n, const std::string& i) : name(n), instance(i) {}
- void set(const string& _name) {
+ void set(const std::string& _name) {
name = _name;
}
bool empty() const {
return name.empty();
}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(name, bl);
encode(instance, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(name, bl);
decode(instance, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_string("name", name);
f->dump_string("instance", instance);
}
void decode_json(JSONObj *obj);
- static void generate_test_instances(list<cls_rgw_obj_key*>& ls) {
+ static void generate_test_instances(std::list<cls_rgw_obj_key*>& ls) {
ls.push_back(new cls_rgw_obj_key);
ls.push_back(new cls_rgw_obj_key);
ls.back()->name = "name";
std::string locator;
bool exists;
rgw_bucket_dir_entry_meta meta;
- multimap<string, rgw_bucket_pending_info> pending_map;
+ std::multimap<std::string, rgw_bucket_pending_info> pending_map;
uint64_t index_ver;
- string tag;
+ std::string tag;
uint16_t flags;
uint64_t versioned_epoch;
rgw_bucket_dir_entry() :
exists(false), index_ver(0), flags(0), versioned_epoch(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(8, 3, bl);
encode(key.name, bl);
encode(ver.epoch, bl);
encode(versioned_epoch, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(8, 3, 3, bl);
decode(key.name, bl);
decode(ver.epoch, bl);
return flags & rgw_bucket_dir_entry::FLAG_COMMON_PREFIX;
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
- static void generate_test_instances(list<rgw_bucket_dir_entry*>& o);
+ static void generate_test_instances(std::list<rgw_bucket_dir_entry*>& o);
};
WRITE_CLASS_ENCODER(rgw_bucket_dir_entry)
struct rgw_cls_bi_entry {
BIIndexType type;
- string idx;
- bufferlist data;
+ std::string idx;
+ ceph::buffer::list data;
rgw_cls_bi_entry() : type(BIIndexType::Invalid) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(type, bl);
encode(idx, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
uint8_t c;
decode(c, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj, cls_rgw_obj_key *effective_key = NULL);
bool get_info(cls_rgw_obj_key *key, RGWObjCategory *category,
struct rgw_bucket_olh_log_entry {
uint64_t epoch;
OLHLogOp op;
- string op_tag;
+ std::string op_tag;
cls_rgw_obj_key key;
bool delete_marker;
rgw_bucket_olh_log_entry() : epoch(0), op(CLS_RGW_OLH_OP_UNKNOWN), delete_marker(false) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(epoch, bl);
encode((__u8)op, bl);
encode(delete_marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(epoch, bl);
uint8_t c;
decode(delete_marker, bl);
DECODE_FINISH(bl);
}
- static void generate_test_instances(list<rgw_bucket_olh_log_entry*>& o);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_bucket_olh_log_entry*>& o);
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
};
WRITE_CLASS_ENCODER(rgw_bucket_olh_log_entry)
cls_rgw_obj_key key;
bool delete_marker;
uint64_t epoch;
- map<uint64_t, vector<struct rgw_bucket_olh_log_entry> > pending_log;
- string tag;
+ std::map<uint64_t, std::vector<struct rgw_bucket_olh_log_entry> > pending_log;
+ std::string tag;
bool exists;
bool pending_removal;
rgw_bucket_olh_entry() : delete_marker(false), epoch(0), exists(false), pending_removal(false) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(key, bl);
encode(delete_marker, bl);
encode(pending_removal, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(key, bl);
decode(delete_marker, bl);
decode(pending_removal, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
};
WRITE_CLASS_ENCODER(rgw_bucket_olh_entry)
struct rgw_bi_log_entry {
- string id;
- string object;
- string instance;
+ std::string id;
+ std::string object;
+ std::string instance;
ceph::real_time timestamp;
rgw_bucket_entry_ver ver;
RGWModifyOp op;
RGWPendingState state;
uint64_t index_ver;
- string tag;
+ std::string tag;
uint16_t bilog_flags;
- string owner; /* only being set if it's a delete marker */
- string owner_display_name; /* only being set if it's a delete marker */
+ std::string owner; /* only being set if it's a delete marker */
+ std::string owner_display_name; /* only being set if it's a delete marker */
rgw_zone_set zones_trace;
rgw_bi_log_entry() : op(CLS_RGW_OP_UNKNOWN), state(CLS_RGW_STATE_PENDING_MODIFY), index_ver(0), bilog_flags(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(4, 1, bl);
encode(id, bl);
encode(object, bl);
encode(zones_trace, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(4, bl);
decode(id, bl);
decode(object, bl);
}
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
- static void generate_test_instances(list<rgw_bi_log_entry*>& o);
+ static void generate_test_instances(std::list<rgw_bi_log_entry*>& o);
bool is_versioned() {
return ((bilog_flags & RGW_BILOG_FLAG_VERSIONED_OP) != 0);
rgw_bucket_category_stats() : total_size(0), total_size_rounded(0), num_entries(0) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(3, 2, bl);
encode(total_size, bl);
encode(total_size_rounded, bl);
encode(actual_size, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
decode(total_size, bl);
decode(total_size_rounded, bl);
}
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_bucket_category_stats*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_bucket_category_stats*>& o);
};
WRITE_CLASS_ENCODER(rgw_bucket_category_stats)
DONE = 2
};
-static inline std::string to_string(const cls_rgw_reshard_status status)
+inline std::string to_string(const cls_rgw_reshard_status status)
{
switch (status) {
case cls_rgw_reshard_status::NOT_RESHARDING:
using RESHARD_STATUS = cls_rgw_reshard_status;
cls_rgw_reshard_status reshard_status{RESHARD_STATUS::NOT_RESHARDING};
- string new_bucket_instance_id;
+ std::string new_bucket_instance_id;
int32_t num_shards{-1};
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode((uint8_t)reshard_status, bl);
encode(new_bucket_instance_id, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
uint8_t s;
decode(s, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_bucket_instance_entry*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_bucket_instance_entry*>& o);
void clear() {
reshard_status = RESHARD_STATUS::NOT_RESHARDING;
new_bucket_instance_id.clear();
}
- void set_status(const string& new_instance_id,
+ void set_status(const std::string& new_instance_id,
int32_t new_num_shards,
cls_rgw_reshard_status s) {
reshard_status = s;
WRITE_CLASS_ENCODER(cls_rgw_bucket_instance_entry)
struct rgw_bucket_dir_header {
- map<RGWObjCategory, rgw_bucket_category_stats> stats;
+ std::map<RGWObjCategory, rgw_bucket_category_stats> stats;
uint64_t tag_timeout;
uint64_t ver;
uint64_t master_ver;
- string max_marker;
+ std::string max_marker;
cls_rgw_bucket_instance_entry new_instance;
bool syncstopped;
rgw_bucket_dir_header() : tag_timeout(0), ver(0), master_ver(0), syncstopped(false) {}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(7, 2, bl);
encode(stats, bl);
encode(tag_timeout, bl);
encode(syncstopped,bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, bl);
decode(stats, bl);
if (struct_v > 2) {
}
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_bucket_dir_header*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_bucket_dir_header*>& o);
bool resharding() const {
return new_instance.resharding();
struct rgw_bucket_dir {
rgw_bucket_dir_header header;
- boost::container::flat_map<string, rgw_bucket_dir_entry> m;
+ boost::container::flat_map<std::string, rgw_bucket_dir_entry> m;
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(2, 2, bl);
encode(header, bl);
encode(m, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
decode(header, bl);
decode(m, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<rgw_bucket_dir*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<rgw_bucket_dir*>& o);
};
WRITE_CLASS_ENCODER(rgw_bucket_dir)
rgw_usage_data() : bytes_sent(0), bytes_received(0), ops(0), successful_ops(0) {}
rgw_usage_data(uint64_t sent, uint64_t received) : bytes_sent(sent), bytes_received(received), ops(0), successful_ops(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(bytes_sent, bl);
encode(bytes_received, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(bytes_sent, bl);
decode(bytes_received, bl);
struct rgw_usage_log_entry {
rgw_user owner;
rgw_user payer; /* if empty, same as owner */
- string bucket;
+ std::string bucket;
uint64_t epoch;
rgw_usage_data total_usage; /* this one is kept for backwards compatibility */
- map<string, rgw_usage_data> usage_map;
+ std::map<std::string, rgw_usage_data> usage_map;
rgw_usage_log_entry() : epoch(0) {}
- rgw_usage_log_entry(string& o, string& b) : owner(o), bucket(b), epoch(0) {}
- rgw_usage_log_entry(string& o, string& p, string& b) : owner(o), payer(p), bucket(b), epoch(0) {}
+ rgw_usage_log_entry(std::string& o, std::string& b) : owner(o), bucket(b), epoch(0) {}
+ rgw_usage_log_entry(std::string& o, std::string& p, std::string& b) : owner(o), payer(p), bucket(b), epoch(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(3, 1, bl);
encode(owner.to_str(), bl);
encode(bucket, bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(3, bl);
- string s;
+ std::string s;
decode(s, bl);
owner.from_str(s);
decode(bucket, bl);
decode(usage_map, bl);
}
if (struct_v >= 3) {
- string p;
+ std::string p;
decode(p, bl);
payer.from_str(p);
}
DECODE_FINISH(bl);
}
- void aggregate(const rgw_usage_log_entry& e, map<string, bool> *categories = NULL) {
+ void aggregate(const rgw_usage_log_entry& e,
+ std::map<std::string, bool> *categories = NULL) {
if (owner.empty()) {
owner = e.owner;
bucket = e.bucket;
payer = e.payer;
}
- map<string, rgw_usage_data>::const_iterator iter;
- for (iter = e.usage_map.begin(); iter != e.usage_map.end(); ++iter) {
+ for (auto iter = e.usage_map.begin(); iter != e.usage_map.end(); ++iter) {
if (!categories || !categories->size() || categories->count(iter->first)) {
add(iter->first, iter->second);
}
}
}
- void sum(rgw_usage_data& usage, map<string, bool>& categories) const {
+ void sum(rgw_usage_data& usage,
+ std::map<std::string, bool>& categories) const {
usage = rgw_usage_data();
- for (map<string, rgw_usage_data>::const_iterator iter = usage_map.begin(); iter != usage_map.end(); ++iter) {
+ for (auto iter = usage_map.begin(); iter != usage_map.end(); ++iter) {
if (!categories.size() || categories.count(iter->first)) {
usage.aggregate(iter->second);
}
}
}
- void add(const string& category, const rgw_usage_data& data) {
+ void add(const std::string& category, const rgw_usage_data& data) {
usage_map[category].aggregate(data);
total_usage.aggregate(data);
}
- void dump(Formatter* f) const;
- static void generate_test_instances(list<rgw_usage_log_entry*>& o);
+ void dump(ceph::Formatter* f) const;
+ static void generate_test_instances(std::list<rgw_usage_log_entry*>& o);
};
WRITE_CLASS_ENCODER(rgw_usage_log_entry)
struct rgw_usage_log_info {
- vector<rgw_usage_log_entry> entries;
+ std::vector<rgw_usage_log_entry> entries;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
DECODE_FINISH(bl);
WRITE_CLASS_ENCODER(rgw_usage_log_info)
struct rgw_user_bucket {
- string user;
- string bucket;
+ std::string user;
+ std::string bucket;
rgw_user_bucket() {}
- rgw_user_bucket(const string& u, const string& b) : user(u), bucket(b) {}
+ rgw_user_bucket(const std::string& u, const std::string& b) : user(u), bucket(b) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(user, bl);
encode(bucket, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(user, bl);
decode(bucket, bl);
};
struct cls_rgw_obj {
- string pool;
+ std::string pool;
cls_rgw_obj_key key;
- string loc;
+ std::string loc;
cls_rgw_obj() {}
- cls_rgw_obj(string& _p, cls_rgw_obj_key& _k) : pool(_p), key(_k) {}
+ cls_rgw_obj(std::string& _p, cls_rgw_obj_key& _k) : pool(_p), key(_k) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(pool, bl);
encode(key.name, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(pool, bl);
decode(key.name, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_string("pool", pool);
f->dump_string("oid", key.name);
f->dump_string("key", loc);
f->dump_string("instance", key.instance);
}
- static void generate_test_instances(list<cls_rgw_obj*>& ls) {
+ static void generate_test_instances(std::list<cls_rgw_obj*>& ls) {
ls.push_back(new cls_rgw_obj);
ls.push_back(new cls_rgw_obj);
ls.back()->pool = "mypool";
WRITE_CLASS_ENCODER(cls_rgw_obj)
struct cls_rgw_obj_chain {
- list<cls_rgw_obj> objs;
+ std::list<cls_rgw_obj> objs;
cls_rgw_obj_chain() {}
- void push_obj(const string& pool, const cls_rgw_obj_key& key, const string& loc) {
+ void push_obj(const std::string& pool, const cls_rgw_obj_key& key, const std::string& loc) {
cls_rgw_obj obj;
obj.pool = pool;
obj.key = key;
objs.push_back(obj);
}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(objs, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(objs, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->open_array_section("objs");
- for (list<cls_rgw_obj>::const_iterator p = objs.begin(); p != objs.end(); ++p) {
+ for (std::list<cls_rgw_obj>::const_iterator p = objs.begin(); p != objs.end(); ++p) {
f->open_object_section("obj");
p->dump(f);
f->close_section();
}
f->close_section();
}
- static void generate_test_instances(list<cls_rgw_obj_chain*>& ls) {
+ static void generate_test_instances(std::list<cls_rgw_obj_chain*>& ls) {
ls.push_back(new cls_rgw_obj_chain);
}
struct cls_rgw_gc_obj_info
{
- string tag;
+ std::string tag;
cls_rgw_obj_chain chain;
ceph::real_time time;
cls_rgw_gc_obj_info() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(tag, bl);
encode(chain, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(tag, bl);
decode(chain, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_string("tag", tag);
f->open_object_section("chain");
chain.dump(f);
f->close_section();
f->dump_stream("time") << time;
}
- static void generate_test_instances(list<cls_rgw_gc_obj_info*>& ls) {
+ static void generate_test_instances(std::list<cls_rgw_gc_obj_info*>& ls) {
ls.push_back(new cls_rgw_gc_obj_info);
ls.push_back(new cls_rgw_gc_obj_info);
ls.back()->tag = "footag";
struct cls_rgw_lc_obj_head
{
time_t start_date = 0;
- string marker;
+ std::string marker;
cls_rgw_lc_obj_head() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
uint64_t t = start_date;
encode(t, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
uint64_t t;
decode(t, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_lc_obj_head*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_lc_obj_head*>& ls);
};
WRITE_CLASS_ENCODER(cls_rgw_lc_obj_head)
struct cls_rgw_reshard_entry
{
ceph::real_time time;
- string tenant;
- string bucket_name;
- string bucket_id;
- string new_instance_id;
+ std::string tenant;
+ std::string bucket_name;
+ std::string bucket_id;
+ std::string new_instance_id;
uint32_t old_num_shards{0};
uint32_t new_num_shards{0};
cls_rgw_reshard_entry() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(time, bl);
encode(tenant, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(time, bl);
decode(tenant, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_rgw_reshard_entry*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_rgw_reshard_entry*>& o);
- static void generate_key(const string& tenant, const string& bucket_name, string *key);
- void get_key(string *key) const;
+ static void generate_key(const std::string& tenant, const std::string& bucket_name, std::string *key);
+ void get_key(std::string *key) const;
};
WRITE_CLASS_ENCODER(cls_rgw_reshard_entry)
#define GC_LIST_DEFAULT_MAX 128
+using std::string;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+using ceph::make_timespan;
+using ceph::real_time;
+
CLS_VER(1,0)
CLS_NAME(rgw_gc)
cls_rgw_gc_queue_init_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_init: failed to decode entry\n");
return -EINVAL;
}
cls_rgw_gc_set_entry_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rgw_gc_queue_enqueue: failed to decode entry\n");
return -EINVAL;
}
cls_rgw_gc_list_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_list_entries(): failed to decode input\n");
return -EINVAL;
}
auto iter_urgent_data = head.bl_urgent_data.cbegin();
try {
decode(urgent_data, iter_urgent_data);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_list_entries(): failed to decode urgent data\n");
return -EINVAL;
}
cls_rgw_gc_obj_info info;
try {
decode(info, it.data);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_list_entries(): failed to decode gc info\n");
return -EINVAL;
}
auto iter = bl_xattrs.cbegin();
try {
decode(xattr_urgent_data_map, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rgw_gc_queue_list_entries(): failed to decode xattrs urgent data map\n");
return -EINVAL;
} //end - catch
cls_rgw_gc_queue_remove_entries_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_remove_entries(): failed to decode input\n");
return -EINVAL;
}
auto iter_urgent_data = head.bl_urgent_data.cbegin();
try {
decode(urgent_data, iter_urgent_data);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_remove_entries(): failed to decode urgent data\n");
return -EINVAL;
}
cls_rgw_gc_obj_info info;
try {
decode(info, it.data);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_remove_entries(): failed to decode gc info\n");
return -EINVAL;
}
auto iter = bl_xattrs.cbegin();
try {
decode(xattr_urgent_data_map, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_remove_entries(): failed to decode xattrs urgent data map\n");
return -EINVAL;
} //end - catch
cls_rgw_gc_queue_defer_entry_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_update_entry(): failed to decode input\n");
return -EINVAL;
}
cls_rgw_gc_urgent_data urgent_data;
try {
decode(urgent_data, bl_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(5, "ERROR: cls_rgw_gc_queue_update_entry(): failed to decode urgent data\n");
return -EINVAL;
}
auto iter = bl_xattrs.cbegin();
try {
decode(xattr_urgent_data_map, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rgw_gc_queue_update_entry(): failed to decode xattrs urgent data map\n");
return -EINVAL;
} //end - catch
auto iter = bl_xattrs.cbegin();
try {
decode(xattr_urgent_data_map, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_rgw_gc_queue_remove_entries(): failed to decode xattrs urgent data map\n");
return -EINVAL;
} //end - catch
#include "cls/queue/cls_queue_const.h"
#include "cls/rgw_gc/cls_rgw_gc_client.h"
+using std::list;
+using std::string;
+
+using ceph::decode;
+using ceph::encode;
+
using namespace librados;
void cls_rgw_gc_queue_init(ObjectWriteOperation& op, uint64_t size, uint64_t num_deferred_entries)
auto iter = out.cbegin();
try {
decode(op_ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
auto iter = out.cbegin();
try {
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_RGW_GC_CLIENT_H
#define CEPH_CLS_RGW_GC_CLIENT_H
#include "include/rados/librados.hpp"
-#include "cls/rgw_gc/cls_rgw_gc_types.h"
-#include "cls/queue/cls_queue_ops.h"
+
#include "common/ceph_time.h"
+#include "cls/queue/cls_queue_ops.h"
+#include "cls/rgw/cls_rgw_types.h"
+#include "cls/rgw_gc/cls_rgw_gc_types.h"
+
void cls_rgw_gc_queue_init(librados::ObjectWriteOperation& op, uint64_t size, uint64_t num_deferred_entries);
-int cls_rgw_gc_queue_get_capacity(librados::IoCtx& io_ctx, const string& oid, uint64_t& size);
+int cls_rgw_gc_queue_get_capacity(librados::IoCtx& io_ctx, const std::string& oid, uint64_t& size);
void cls_rgw_gc_queue_enqueue(librados::ObjectWriteOperation& op, uint32_t expiration_secs, const cls_rgw_gc_obj_info& info);
-int cls_rgw_gc_queue_list_entries(librados::IoCtx& io_ctx, const string& oid, const string& marker, uint32_t max, bool expired_only,
- list<cls_rgw_gc_obj_info>& entries, bool *truncated, string& next_marker);
+int cls_rgw_gc_queue_list_entries(librados::IoCtx& io_ctx, const std::string& oid, const std::string& marker, uint32_t max, bool expired_only,
+ std::list<cls_rgw_gc_obj_info>& entries, bool *truncated, std::string& next_marker);
void cls_rgw_gc_queue_remove_entries(librados::ObjectWriteOperation& op, uint32_t num_entries);
void cls_rgw_gc_queue_defer_entry(librados::ObjectWriteOperation& op, uint32_t expiration_secs, const cls_rgw_gc_obj_info& info);
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_RGW_GC_OPS_H
#define CEPH_CLS_RGW_GC_OPS_H
cls_rgw_gc_queue_init_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(size, bl);
encode(num_deferred_entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(size, bl);
decode(num_deferred_entries, bl);
cls_rgw_gc_queue_remove_entries_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(num_entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(num_entries, bl);
DECODE_FINISH(bl);
cls_rgw_gc_obj_info info;
cls_rgw_gc_queue_defer_entry_op() : expiration_secs(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(expiration_secs, bl);
encode(info, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(expiration_secs, bl);
decode(info, bl);
}
};
WRITE_CLASS_ENCODER(cls_rgw_gc_queue_defer_entry_op)
-#endif /* CEPH_CLS_RGW_GC_OPS_H */
\ No newline at end of file
+#endif /* CEPH_CLS_RGW_GC_OPS_H */
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_RGW_GC_TYPES_H
#define CEPH_CLS_RGW_GC_TYPES_H
struct cls_rgw_gc_urgent_data
{
- std::unordered_map<string,ceph::real_time> urgent_data_map;
+ std::unordered_map<std::string, ceph::real_time> urgent_data_map;
uint32_t num_urgent_data_entries{0}; // requested by user
uint32_t num_head_urgent_entries{0}; // actual number of entries in queue head
uint32_t num_xattr_urgent_entries{0}; // actual number of entries in xattr in case of spill over
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(urgent_data_map, bl);
encode(num_urgent_data_entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(urgent_data_map, bl);
decode(num_urgent_data_entries, bl);
};
WRITE_CLASS_ENCODER(cls_rgw_gc_urgent_data)
-#endif
\ No newline at end of file
+#endif
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include <errno.h>
#include "include/compat.h"
+using std::map;
+using std::string;
+
+using ceph::bufferlist;
+
CLS_VER(1,0)
CLS_NAME(timeindex)
cls_timeindex_add_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_timeindex_add_op(): failed to decode op");
return -EINVAL;
}
- for (list<cls_timeindex_entry>::iterator iter = op.entries.begin();
+ for (auto iter = op.entries.begin();
iter != op.entries.end();
++iter) {
cls_timeindex_entry& entry = *iter;
cls_timeindex_list_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_timeindex_list_op(): failed to decode op");
return -EINVAL;
}
return rc;
}
- list<cls_timeindex_entry>& entries = ret.entries;
- map<string, bufferlist>::iterator iter = keys.begin();
+ auto& entries = ret.entries;
+ auto iter = keys.begin();
string marker;
cls_timeindex_trim_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_timeindex_trim: failed to decode entry");
return -EINVAL;
}
return rc;
}
- map<string, bufferlist>::iterator iter = keys.begin();
+ auto iter = keys.begin();
bool removed = false;
for (; iter != keys.end(); ++iter) {
///* dtor
~TimeindexListCtx() {}
- void handle_completion(int r, bufferlist& bl) override {
+ void handle_completion(int r, ceph::buffer::list& bl) override {
if (r >= 0) {
cls_timeindex_list_ret ret;
try {
*truncated = ret.truncated;
if (marker)
*marker = ret.marker;
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
// nothing we can do about it atm
}
}
cls_timeindex_entry& entry,
const utime_t& key_timestamp,
const std::string& key_ext,
- bufferlist& bl);
+ ceph::buffer::list& bl);
void cls_timeindex_add(
librados::ObjectWriteOperation& op,
librados::ObjectWriteOperation& op,
const utime_t& timestamp,
const std::string& name,
- const bufferlist& bl);
+ const ceph::buffer::list& bl);
void cls_timeindex_list(
librados::ObjectReadOperation& op,
#include "cls_timeindex_types.h"
struct cls_timeindex_add_op {
- list<cls_timeindex_entry> entries;
+ std::list<cls_timeindex_entry> entries;
cls_timeindex_add_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
DECODE_FINISH(bl);
struct cls_timeindex_list_op {
utime_t from_time;
- string marker; /* if not empty, overrides from_time */
+ std::string marker; /* if not empty, overrides from_time */
utime_t to_time; /* not inclusive */
int max_entries; /* upperbound to returned num of entries
might return less than that and still be truncated */
cls_timeindex_list_op() : max_entries(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(from_time, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(from_time, bl);
decode(marker, bl);
WRITE_CLASS_ENCODER(cls_timeindex_list_op)
struct cls_timeindex_list_ret {
- list<cls_timeindex_entry> entries;
- string marker;
+ std::list<cls_timeindex_entry> entries;
+ std::string marker;
bool truncated;
cls_timeindex_list_ret() : truncated(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
decode(marker, bl);
struct cls_timeindex_trim_op {
utime_t from_time;
utime_t to_time; /* inclusive */
- string from_marker;
- string to_marker;
+ std::string from_marker;
+ std::string to_marker;
cls_timeindex_trim_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(from_time, bl);
encode(to_time, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(from_time, bl);
decode(to_time, bl);
utime_t key_ts;
/* Not mandatory. The name_ext field, if not empty, will form second
* part of the key. */
- string key_ext;
+ std::string key_ext;
/* Become value of OMAP-based mapping. */
- bufferlist value;
+ ceph::buffer::list value;
cls_timeindex_entry() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(key_ts, bl);
encode(key_ext, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(key_ts, bl);
decode(key_ext, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_timeindex_entry*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_timeindex_entry*>& o);
};
WRITE_CLASS_ENCODER(cls_timeindex_entry)
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include <errno.h>
#include "cls_user_ops.h"
+using std::map;
+using std::string;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+
CLS_VER(1,0)
CLS_NAME(user)
try {
auto iter = bl.cbegin();
decode(entry, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: failed to decode entry %s", key.c_str());
return -EIO;
}
try {
decode(*header, bl);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: failed to decode user header");
return -EIO;
}
cls_user_set_buckets_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_user_add_op(): failed to decode op");
return -EINVAL;
}
return ret;
}
- for (list<cls_user_bucket_entry>::iterator iter = op.entries.begin();
- iter != op.entries.end(); ++iter) {
+ for (auto iter = op.entries.begin(); iter != op.entries.end(); ++iter) {
cls_user_bucket_entry& update_entry = *iter;
string key;
cls_user_complete_stats_sync_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_user_add_op(): failed to decode op");
return -EINVAL;
}
cls_user_remove_bucket_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_user_add_op(): failed to decode op");
return -EINVAL;
}
cls_user_list_buckets_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_user_list_op(): failed to decode op");
return -EINVAL;
}
to_index.c_str(),
match_prefix.c_str());
- list<cls_user_bucket_entry>& entries = ret.entries;
- map<string, bufferlist>::iterator iter = keys.begin();
+ auto& entries = ret.entries;
+ auto iter = keys.begin();
string marker;
cls_user_bucket_entry e;
decode(e, biter);
entries.push_back(e);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: cls_user_list: could not decode entry, index=%s", index.c_str());
}
}
cls_user_get_header_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_user_get_header_op(): failed to decode op");
return -EINVAL;
}
try {
auto bliter = in->cbegin();
decode(op, bliter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s failed to decode op", __func__);
return -EINVAL;
}
auto bl = kv.second;
auto bliter = bl.cbegin();
decode(e, bliter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: %s failed to decode bucket entry for %s",
__func__, kv.first.c_str());
return -EIO;
cls_register_cxx_method(h_class, "reset_user_stats", CLS_METHOD_RD | CLS_METHOD_WR, cls_user_reset_stats, &h_user_reset_stats);
return;
}
-
#include "cls/user/cls_user_client.h"
#include "include/rados/librados.hpp"
+using std::list;
+using std::string;
-using namespace librados;
+using ceph::bufferlist;
+using ceph::real_clock;
+using librados::IoCtx;
+using librados::ObjectOperationCompletion;
+using librados::ObjectReadOperation;
void cls_user_set_buckets(librados::ObjectWriteOperation& op, list<cls_user_bucket_entry>& entries, bool add)
{
*truncated = ret.truncated;
if (marker)
*marker = ret.marker;
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
r = -EIO;
}
}
decode(ret, iter);
if (header)
*header = ret.header;
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
r = -EIO;
}
if (ret_ctx) {
encode(call, in);
ObjectReadOperation op;
op.exec("user", "get_header", in, new ClsUserGetHeaderCtx(NULL, ctx, NULL)); /* no need to pass pret, as we'll call ctx->handle_response() with correct error */
- AioCompletion *c = librados::Rados::aio_create_completion(nullptr, nullptr);
+ auto c = librados::Rados::aio_create_completion(nullptr, nullptr);
int r = io_ctx.aio_operate(oid, c, &op, NULL);
c->release();
if (r < 0)
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_CLS_USER_CLIENT_H
* user objclass
*/
-void cls_user_set_buckets(librados::ObjectWriteOperation& op, list<cls_user_bucket_entry>& entries, bool add);
+void cls_user_set_buckets(librados::ObjectWriteOperation& op, std::list<cls_user_bucket_entry>& entries, bool add);
void cls_user_complete_stats_sync(librados::ObjectWriteOperation& op);
void cls_user_remove_bucket(librados::ObjectWriteOperation& op, const cls_user_bucket& bucket);
void cls_user_bucket_list(librados::ObjectReadOperation& op,
- const string& in_marker,
- const string& end_marker,
- int max_entries,
- list<cls_user_bucket_entry>& entries,
- string *out_marker,
- bool *truncated,
- int *pret);
+ const std::string& in_marker,
+ const std::string& end_marker,
+ int max_entries,
+ std::list<cls_user_bucket_entry>& entries,
+ std::string *out_marker,
+ bool *truncated,
+ int *pret);
void cls_user_get_header(librados::ObjectReadOperation& op, cls_user_header *header, int *pret);
-int cls_user_get_header_async(librados::IoCtx& io_ctx, string& oid, RGWGetUserHeader_CB *ctx);
+int cls_user_get_header_async(librados::IoCtx& io_ctx, std::string& oid, RGWGetUserHeader_CB *ctx);
void cls_user_reset_stats(librados::ObjectWriteOperation& op);
#endif
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "cls/user/cls_user_ops.h"
#include "common/Formatter.h"
#include "common/ceph_json.h"
+using std::list;
+
+using ceph::Formatter;
+
void cls_user_set_buckets_op::dump(Formatter *f) const
{
encode_json("entries", entries, f);
#include "cls_user_types.h"
struct cls_user_set_buckets_op {
- list<cls_user_bucket_entry> entries;
+ std::list<cls_user_bucket_entry> entries;
bool add;
- real_time time; /* op time */
+ ceph::real_time time; /* op time */
cls_user_set_buckets_op() : add(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
encode(add, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
decode(add, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_set_buckets_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_set_buckets_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_set_buckets_op)
cls_user_remove_bucket_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(bucket, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(bucket, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_remove_bucket_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_remove_bucket_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_remove_bucket_op)
struct cls_user_list_buckets_op {
- string marker;
- string end_marker;
+ std::string marker;
+ std::string end_marker;
int max_entries; /* upperbound to returned num of entries
might return less than that and still be truncated */
cls_user_list_buckets_op()
: max_entries(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(marker, bl);
encode(max_entries, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(marker, bl);
decode(max_entries, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_list_buckets_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_list_buckets_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_list_buckets_op)
struct cls_user_list_buckets_ret {
- list<cls_user_bucket_entry> entries;
- string marker;
+ std::list<cls_user_bucket_entry> entries;
+ std::string marker;
bool truncated;
cls_user_list_buckets_ret() : truncated(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(entries, bl);
encode(marker, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(entries, bl);
decode(marker, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_list_buckets_ret*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_list_buckets_ret*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_list_buckets_ret)
struct cls_user_get_header_op {
cls_user_get_header_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_get_header_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_get_header_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_get_header_op)
struct cls_user_reset_stats_op {
- real_time time;
+ ceph::real_time time;
cls_user_reset_stats_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(time, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(time, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_reset_stats_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_reset_stats_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_reset_stats_op);
cls_user_get_header_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(header, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(header, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_get_header_ret*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_get_header_ret*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_get_header_ret)
struct cls_user_complete_stats_sync_op {
- real_time time;
+ ceph::real_time time;
cls_user_complete_stats_sync_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(time, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(time, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_complete_stats_sync_op*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_complete_stats_sync_op*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_complete_stats_sync_op)
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "cls/user/cls_user_types.h"
#include "common/ceph_json.h"
#include "include/utime.h"
+using std::list;
+using std::string;
+
+using ceph::Formatter;
+using ceph::bufferlist;
+using ceph::real_clock;
+
void cls_user_gen_test_bucket(cls_user_bucket *bucket, int i)
{
char buf[16];
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_CLS_USER_TYPES_H
std::string data_extra_pool;
} explicit_placement;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
/* since new version of this structure is not backward compatible,
* we have older rgw running against newer osd if we encode it
* in the new way. Only encode newer version if placement_id is
ENCODE_FINISH(bl);
}
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START_LEGACY_COMPAT_LEN(8, 3, 3, bl);
decode(name, bl);
if (struct_v < 8) {
return name.compare(b.name) < 0;
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_bucket*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_bucket*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_bucket)
cls_user_bucket_entry() : size(0), size_rounded(0), count(0), user_stats_sync(false) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(9, 5, bl);
uint64_t s = size;
__u32 mt = ceph::real_clock::to_time_t(creation_time);
- string empty_str; // originally had the bucket name here, but we encode bucket later
+ std::string empty_str; // originally had the bucket name here, but we encode bucket later
encode(empty_str, bl);
encode(s, bl);
encode(mt, bl);
//::encode(placement_rule, bl); removed in v9
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START_LEGACY_COMPAT_LEN(9, 5, 5, bl);
__u32 mt;
uint64_t s;
- string empty_str; // backward compatibility
+ std::string empty_str; // backward compatibility
decode(empty_str, bl);
decode(s, bl);
decode(mt, bl);
}
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_bucket_entry*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_bucket_entry*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_bucket_entry)
total_bytes(0),
total_bytes_rounded(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(total_entries, bl);
encode(total_bytes, bl);
encode(total_bytes_rounded, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(total_entries, bl);
decode(total_bytes, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_stats*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_stats*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_stats)
ceph::real_time last_stats_sync; /* last time a full stats sync completed */
ceph::real_time last_stats_update; /* last time a stats update was done */
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(stats, bl);
encode(last_stats_sync, bl);
encode(last_stats_update, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(stats, bl);
decode(last_stats_sync, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<cls_user_header*>& ls);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<cls_user_header*>& ls);
};
WRITE_CLASS_ENCODER(cls_user_header)
void cls_user_gen_test_header(cls_user_header *h);
#endif
-
-
#include "include/compat.h"
+using std::list;
+
+using ceph::bufferlist;
+
CLS_VER(1,0)
CLS_NAME(version)
try {
auto iter = bl.cbegin();
decode(*objv, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(0, "ERROR: read_version(): failed to decode version entry\n");
return -EIO;
}
cls_version_set_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_version_get(): failed to decode entry\n");
return -EINVAL;
}
cls_version_inc_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_version_get(): failed to decode entry\n");
return -EINVAL;
}
cls_version_check_op op;
try {
decode(op, in_iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
CLS_LOG(1, "ERROR: cls_version_get(): failed to decode entry\n");
return -EINVAL;
}
int ret = read_version(hctx, &objv, false);
if (ret < 0)
return ret;
-
+
if (!check_conds(op.conds, objv)) {
CLS_LOG(20, "cls_version: failed condition check");
return -ECANCELED;
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#include <errno.h>
#include "cls/version/cls_version_client.h"
bufferlist in;
cls_version_inc_op call;
call.objv = objv;
-
+
obj_version_cond c;
c.cond = cond;
c.ver = objv;
auto iter = outbl.cbegin();
decode(ret, iter);
*objv = ret.objv;
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
// nothing we can do about it atm
}
}
op.exec("version", "read", inbl, new VersionReadCtx(objv));
}
-int cls_version_read(librados::IoCtx& io_ctx, string& oid, obj_version *ver)
+int cls_version_read(librados::IoCtx& io_ctx, std::string& oid, obj_version *ver)
{
bufferlist in, out;
int r = io_ctx.exec(oid, "version", "read", in, out);
try {
auto iter = out.cbegin();
decode(ret, iter);
- } catch (buffer::error& err) {
+ } catch (ceph::buffer::error& err) {
return -EIO;
}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_VERSION_CLIENT_H
#define CEPH_CLS_VERSION_CLIENT_H
// these overloads which call io_ctx.operate() or io_ctx.exec() should not be called in the rgw.
// rgw_rados_operate() should be called after the overloads w/o calls to io_ctx.operate()/exec()
#ifndef CLS_CLIENT_HIDE_IOCTX
-int cls_version_read(librados::IoCtx& io_ctx, string& oid, obj_version *ver);
+int cls_version_read(librados::IoCtx& io_ctx, std::string& oid, obj_version *ver);
#endif
void cls_version_check(librados::ObjectOperation& op, obj_version& ver, VersionCond cond);
cls_version_set_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(objv, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(objv, bl);
DECODE_FINISH(bl);
struct cls_version_inc_op {
obj_version objv;
- list<obj_version_cond> conds;
+ std::list<obj_version_cond> conds;
cls_version_inc_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(objv, bl);
encode(conds, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(objv, bl);
decode(conds, bl);
struct cls_version_check_op {
obj_version objv;
- list<obj_version_cond> conds;
+ std::list<obj_version_cond> conds;
cls_version_check_op() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(objv, bl);
encode(conds, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(objv, bl);
decode(conds, bl);
cls_version_read_ret() {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(objv, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(objv, bl);
DECODE_FINISH(bl);
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
#include "cls/version/cls_version_types.h"
#include "common/Formatter.h"
#include "common/ceph_json.h"
-void obj_version::dump(Formatter *f) const
+void obj_version::dump(ceph::Formatter *f) const
{
f->dump_int("ver", ver);
f->dump_string("tag", tag);
JSONDecoder::decode_json("ver", ver, obj);
JSONDecoder::decode_json("tag", tag, obj);
}
-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLS_VERSION_TYPES_H
#define CEPH_CLS_VERSION_TYPES_H
struct obj_version {
uint64_t ver;
- string tag;
+ std::string tag;
obj_version() : ver(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(ver, bl);
encode(tag, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(ver, bl);
decode(tag, bl);
tag.compare(v.tag) == 0);
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void decode_json(JSONObj *obj);
- static void generate_test_instances(list<obj_version*>& o);
+ static void generate_test_instances(std::list<obj_version*>& o);
};
WRITE_CLASS_ENCODER(obj_version)
struct obj_version ver;
VersionCond cond;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(ver, bl);
uint32_t c = (uint32_t)cond;
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(ver, bl);
uint32_t c;