#include <string>
#include <list>
+#include <vector>
#include <boost/container/flat_map.hpp>
#include "common/ceph_time.h"
#include "common/Formatter.h"
WRITE_CLASS_ENCODER(cls_rgw_obj)
struct cls_rgw_obj_chain {
- std::list<cls_rgw_obj> objs;
-
- cls_rgw_obj_chain() {}
+ std::vector<cls_rgw_obj> objs;
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;
obj.loc = loc;
- objs.push_back(obj);
+ objs.push_back(std::move(obj));
}
void encode(ceph::buffer::list& bl) const {
void dump(ceph::Formatter *f) const {
f->open_array_section("objs");
- for (std::list<cls_rgw_obj>::const_iterator p = objs.begin(); p != objs.end(); ++p) {
+ for (const auto& o : objs) {
f->open_object_section("obj");
- p->dump(f);
+ o.dump(f);
f->close_section();
}
f->close_section();
info.tag << "', time=" << info.time << ", chain.objs.size()=" <<
info.chain.objs.size() << dendl;
- std::list<cls_rgw_obj>::iterator liter;
cls_rgw_obj_chain& chain = info.chain;
utime_t now = ceph_clock_now();
}
}
if (! chain.objs.empty()) {
- for (liter = chain.objs.begin(); liter != chain.objs.end(); ++liter) {
- cls_rgw_obj& obj = *liter;
-
+ for (const auto& obj : chain.objs) {
if (obj.pool != last_pool) {
delete ctx;
ctx = new IoCtx;
formatter->dump_string("tag", info.tag);
formatter->dump_stream("time") << info.time;
formatter->open_array_section("objs");
- list<cls_rgw_obj>::iterator liter;
- cls_rgw_obj_chain& chain = info.chain;
- for (liter = chain.objs.begin(); liter != chain.objs.end(); ++liter) {
- cls_rgw_obj& obj = *liter;
+ for (const auto& obj : info.chain.objs) {
encode_json("obj", obj, formatter.get());
}
formatter->close_section(); // objs
/* verify expected num of objects in chain */
ASSERT_EQ(2, (int)entry.chain.objs.size());
- list<cls_rgw_obj>::iterator oiter = entry.chain.objs.begin();
+ auto oiter = entry.chain.objs.begin();
cls_rgw_obj obj1, obj2;
/* create expected objects */
/* verify expected num of objects in chain */
ASSERT_EQ(2, (int)entry.chain.objs.size());
- list<cls_rgw_obj>::iterator oiter = entry.chain.objs.begin();
+ auto oiter = entry.chain.objs.begin();
cls_rgw_obj obj1, obj2;
/* create expected objects */