*
*/
+#include <list>
+#include <map>
+#include <ostream>
+#include <sstream>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+
#include <boost/assign/list_of.hpp>
-#include "osd_types.h"
#include "include/ceph_features.h"
+#include "include/encoding.h"
#include "include/stringify.h"
extern "C" {
#include "crush/hash.h"
}
+
+#include "common/Formatter.h"
+
#include "OSDMap.h"
+#include "osd_types.h"
+
+using std::list;
+using std::make_pair;
+using std::map;
+using std::ostream;
+using std::ostringstream;
+using std::pair;
+using std::set;
+using std::string;
+using std::stringstream;
+using std::unique_ptr;
+using std::vector;
+
+using ceph::decode;
+using ceph::decode_nohead;
+using ceph::encode;
+using ceph::encode_nohead;
+using ceph::Formatter;
+
+using namespace std::literals;
const char *ceph_osd_flag_name(unsigned flag)
{
return string("-");
}
-void pg_shard_t::encode(bufferlist &bl) const
+void pg_shard_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(osd, bl);
encode(shard, bl);
ENCODE_FINISH(bl);
}
-void pg_shard_t::decode(bufferlist::const_iterator &bl)
+void pg_shard_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(osd, bl);
// -- object_locator_t --
-void object_locator_t::encode(bufferlist& bl) const
+void object_locator_t::encode(ceph::buffer::list& bl) const
{
// verify that nobody's corrupted the locator
ceph_assert(hash == -1 || key.empty());
ENCODE_FINISH_NEW_COMPAT(bl, encode_compat);
}
-void object_locator_t::decode(bufferlist::const_iterator& p)
+void object_locator_t::decode(ceph::buffer::list::const_iterator& p)
{
DECODE_START_LEGACY_COMPAT_LEN(6, 3, 3, p);
if (struct_v < 2) {
}
// -- request_redirect_t --
-void request_redirect_t::encode(bufferlist& bl) const
+void request_redirect_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(1, 1, bl);
encode(redirect_locator, bl);
ENCODE_FINISH(bl);
}
-void request_redirect_t::decode(bufferlist::const_iterator& bl)
+void request_redirect_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START(1, bl);
uint32_t legacy_osd_instructions_len;
f->dump_unsigned("apply_latency_ns", os_apply_latency_ns);
}
-void objectstore_perf_stat_t::encode(bufferlist &bl, uint64_t features) const
+void objectstore_perf_stat_t::encode(ceph::buffer::list &bl, uint64_t features) const
{
uint8_t target_v = 2;
if (!HAVE_FEATURE(features, OS_PERF_STAT_NS)) {
ENCODE_FINISH(bl);
}
-void objectstore_perf_stat_t::decode(bufferlist::const_iterator &bl)
+void objectstore_perf_stat_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(2, bl);
if (struct_v >= 2) {
f->close_section();
}
-void osd_stat_t::encode(bufferlist &bl, uint64_t features) const
+void osd_stat_t::encode(ceph::buffer::list &bl, uint64_t features) const
{
ENCODE_START(10, 2, bl);
ENCODE_FINISH(bl);
}
-void osd_stat_t::decode(bufferlist::const_iterator &bl)
+void osd_stat_t::decode(ceph::buffer::list::const_iterator &bl)
{
int64_t kb, kb_used,kb_avail;
int64_t kb_used_data, kb_used_omap, kb_used_meta;
return false;
}
-void coll_t::encode(bufferlist& bl) const
+void coll_t::encode(ceph::buffer::list& bl) const
{
using ceph::encode;
// when changing this, remember to update encoded_size() too.
return r;
}
-void coll_t::decode(bufferlist::const_iterator& bl)
+void coll_t::decode(ceph::buffer::list::const_iterator& bl)
{
using ceph::decode;
__u8 struct_v;
{
ostringstream oss;
oss << "[";
- for (vector<int32_t>::const_iterator i = a.begin(); i != a.end(); ++i) {
- if (i != a.begin())
+ for (auto i = a.cbegin(); i != a.cend(); ++i) {
+ if (i != a.begin())
oss << ",";
- if (*i != CRUSH_ITEM_NONE)
+ if (*i != CRUSH_ITEM_NONE)
oss << *i;
- else
+ else
oss << "NONE";
}
oss << "]";
f->dump_string("name", name);
}
-void pool_snap_info_t::encode(bufferlist& bl, uint64_t features) const
+void pool_snap_info_t::encode(ceph::buffer::list& bl, uint64_t features) const
{
using ceph::encode;
if ((features & CEPH_FEATURE_PGPOOL3) == 0) {
ENCODE_FINISH(bl);
}
-void pool_snap_info_t::decode(bufferlist::const_iterator& bl)
+void pool_snap_info_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
decode(snapid, bl);
pool_opts_t::opt_desc_t pool_opts_t::get_opt_desc(const std::string& name)
{
- opt_mapping_t::iterator i = opt_mapping.find(name);
+ auto i = opt_mapping.find(name);
ceph_assert(i != opt_mapping.end());
return i->second;
}
const pool_opts_t::value_t& pool_opts_t::get(pool_opts_t::key_t key) const
{
- opts_t::const_iterator i = opts.find(key);
+ auto i = opts.find(key);
ceph_assert(i != opts.end());
return i->second;
}
void pool_opts_t::dump(const std::string& name, Formatter* f) const
{
const opt_desc_t& desc = get_opt_desc(name);
- opts_t::const_iterator i = opts.find(desc.key);
+ auto i = opts.find(desc.key);
if (i == opts.end()) {
return;
}
void pool_opts_t::dump(Formatter* f) const
{
- for (opt_mapping_t::iterator i = opt_mapping.begin(); i != opt_mapping.end();
- ++i) {
+ for (auto i = opt_mapping.cbegin(); i != opt_mapping.cend(); ++i) {
const std::string& name = i->first;
const opt_desc_t& desc = i->second;
- opts_t::const_iterator j = opts.find(desc.key);
+ auto j = opts.find(desc.key);
if (j == opts.end()) {
continue;
}
class pool_opts_encoder_t : public boost::static_visitor<> {
public:
- explicit pool_opts_encoder_t(bufferlist& bl_, uint64_t features)
+ explicit pool_opts_encoder_t(ceph::buffer::list& bl_, uint64_t features)
: bl(bl_),
features(features) {}
}
private:
- bufferlist& bl;
+ ceph::buffer::list& bl;
uint64_t features;
};
-void pool_opts_t::encode(bufferlist& bl, uint64_t features) const
+void pool_opts_t::encode(ceph::buffer::list& bl, uint64_t features) const
{
unsigned v = 2;
if (!HAVE_FEATURE(features, SERVER_NAUTILUS)) {
ENCODE_START(v, 1, bl);
uint32_t n = static_cast<uint32_t>(opts.size());
encode(n, bl);
- for (opts_t::const_iterator i = opts.begin(); i != opts.end(); ++i) {
+ for (auto i = opts.cbegin(); i != opts.cend(); ++i) {
encode(static_cast<int32_t>(i->first), bl);
boost::apply_visitor(pool_opts_encoder_t(bl, features), i->second);
}
ENCODE_FINISH(bl);
}
-void pool_opts_t::decode(bufferlist::const_iterator& bl)
+void pool_opts_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START(1, bl);
__u32 n;
ostream& operator<<(ostream& out, const pool_opts_t& opts)
{
- for (opt_mapping_t::iterator i = opt_mapping.begin(); i != opt_mapping.end();
- ++i) {
+ for (auto i = opt_mapping.begin(); i != opt_mapping.end(); ++i) {
const std::string& name = i->first;
const pool_opts_t::opt_desc_t& desc = i->second;
- pool_opts_t::opts_t::const_iterator j = opts.opts.find(desc.key);
+ auto j = opts.opts.find(desc.key);
if (j == opts.opts.end()) {
continue;
}
f->dump_unsigned("snap_seq", get_snap_seq());
f->dump_unsigned("snap_epoch", get_snap_epoch());
f->open_array_section("pool_snaps");
- for (map<snapid_t, pool_snap_info_t>::const_iterator p = snaps.begin(); p != snaps.end(); ++p) {
+ for (auto p = snaps.cbegin(); p != snaps.cend(); ++p) {
f->open_object_section("pool_snap_info");
p->second.dump(f);
f->close_section();
f->dump_unsigned("quota_max_bytes", quota_max_bytes);
f->dump_unsigned("quota_max_objects", quota_max_objects);
f->open_array_section("tiers");
- for (set<uint64_t>::const_iterator p = tiers.begin(); p != tiers.end(); ++p)
+ for (auto p = tiers.cbegin(); p != tiers.cend(); ++p)
f->dump_unsigned("pool_id", *p);
f->close_section();
f->dump_int("tier_of", tier_of);
snapid_t pg_pool_t::snap_exists(const char *s) const
{
- for (map<snapid_t,pool_snap_info_t>::const_iterator p = snaps.begin();
- p != snaps.end();
- ++p)
+ for (auto p = snaps.cbegin(); p != snaps.cend(); ++p)
if (p->second.name == s)
return p->second.snapid;
return 0;
{
vector<snapid_t> s(snaps.size());
unsigned i = 0;
- for (map<snapid_t, pool_snap_info_t>::const_reverse_iterator p = snaps.rbegin();
- p != snaps.rend();
- ++p)
+ for (auto p = snaps.crbegin(); p != snaps.crend(); ++p)
s[i++] = p->first;
return SnapContext(get_snap_seq(), s);
}
return r;
}
-void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
+void pg_pool_t::encode(ceph::buffer::list& bl, uint64_t features) const
{
using ceph::encode;
if ((features & CEPH_FEATURE_PGPOOL3) == 0) {
ENCODE_FINISH(bl);
}
-void pg_pool_t::decode(bufferlist::const_iterator& bl)
+void pg_pool_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(29, 5, 5, bl);
decode(type, bl);
f->dump_int("num_omap_keys", num_omap_keys);
}
-void object_stat_sum_t::encode(bufferlist& bl) const
+void object_stat_sum_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(19, 14, bl);
#if defined(CEPH_LITTLE_ENDIAN)
ENCODE_FINISH(bl);
}
-void object_stat_sum_t::decode(bufferlist::const_iterator& bl)
+void object_stat_sum_t::decode(ceph::buffer::list::const_iterator& bl)
{
bool decode_finish = false;
DECODE_START(19, bl); // make sure to also update fast decode below
f->close_section();
}
-void object_stat_collection_t::encode(bufferlist& bl) const
+void object_stat_collection_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(2, 2, bl);
encode(sum, bl);
ENCODE_FINISH(bl);
}
-void object_stat_collection_t::decode(bufferlist::const_iterator& bl)
+void object_stat_collection_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
decode(sum, bl);
o.push_back(new object_stat_collection_t(a));
list<object_stat_sum_t*> l;
object_stat_sum_t::generate_test_instances(l);
- for (list<object_stat_sum_t*>::iterator p = l.begin(); p != l.end(); ++p) {
+ for (auto p = l.begin(); p != l.end(); ++p) {
a.add(**p);
o.push_back(new object_stat_collection_t(a));
}
if (primary && osd == acting_primary) {
return true;
} else if (!primary) {
- for(vector<int32_t>::const_iterator it = acting.begin();
- it != acting.end(); ++it)
+ for(auto it = acting.cbegin(); it != acting.cend(); ++it)
{
if (*it == osd)
return true;
f->dump_unsigned("snaptrimq_len", snaptrimq_len);
stats.dump(f);
f->open_array_section("up");
- for (vector<int32_t>::const_iterator p = up.begin(); p != up.end(); ++p)
+ for (auto p = up.cbegin(); p != up.cend(); ++p)
f->dump_int("osd", *p);
f->close_section();
f->open_array_section("acting");
- for (vector<int32_t>::const_iterator p = acting.begin(); p != acting.end(); ++p)
+ for (auto p = acting.cbegin(); p != acting.cend(); ++p)
f->dump_int("osd", *p);
f->close_section();
f->open_array_section("blocked_by");
- for (vector<int32_t>::const_iterator p = blocked_by.begin();
- p != blocked_by.end(); ++p)
+ for (auto p = blocked_by.cbegin(); p != blocked_by.cend(); ++p)
f->dump_int("osd", *p);
f->close_section();
f->dump_int("up_primary", up_primary);
f->dump_int("acting_primary", acting_primary);
f->open_array_section("purged_snaps");
- for (interval_set<snapid_t>::const_iterator i = purged_snaps.begin();
- i != purged_snaps.end();
- ++i) {
+ for (auto i = purged_snaps.begin(); i != purged_snaps.end(); ++i) {
f->open_object_section("interval");
f->dump_stream("start") << i.get_start();
f->dump_stream("length") << i.get_len();
{
f->dump_string("state", pg_state_string(state));
f->open_array_section("up");
- for (vector<int32_t>::const_iterator p = up.begin(); p != up.end(); ++p)
+ for (auto p = up.cbegin(); p != up.cend(); ++p)
f->dump_int("osd", *p);
f->close_section();
f->open_array_section("acting");
- for (vector<int32_t>::const_iterator p = acting.begin(); p != acting.end(); ++p)
+ for (auto p = acting.cbegin(); p != acting.cend(); ++p)
f->dump_int("osd", *p);
f->close_section();
f->dump_int("up_primary", up_primary);
f->dump_int("acting_primary", acting_primary);
}
-void pg_stat_t::encode(bufferlist &bl) const
+void pg_stat_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(25, 22, bl);
encode(version, bl);
ENCODE_FINISH(bl);
}
-void pg_stat_t::decode(bufferlist::const_iterator &bl)
+void pg_stat_t::decode(ceph::buffer::list::const_iterator &bl)
{
bool tmp;
uint32_t old_state;
f->dump_int("num_store_stats", acting);
}
-void pool_stat_t::encode(bufferlist &bl, uint64_t features) const
+void pool_stat_t::encode(ceph::buffer::list &bl, uint64_t features) const
{
using ceph::encode;
if ((features & CEPH_FEATURE_OSDENC) == 0) {
ENCODE_FINISH(bl);
}
-void pool_stat_t::decode(bufferlist::const_iterator &bl)
+void pool_stat_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START_LEGACY_COMPAT_LEN(7, 5, 5, bl);
if (struct_v >= 4) {
// -- pg_history_t --
-void pg_history_t::encode(bufferlist &bl) const
+void pg_history_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(9, 4, bl);
encode(epoch_created, bl);
ENCODE_FINISH(bl);
}
-void pg_history_t::decode(bufferlist::const_iterator &bl)
+void pg_history_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START_LEGACY_COMPAT_LEN(9, 4, 4, bl);
decode(epoch_created, bl);
// -- pg_info_t --
-void pg_info_t::encode(bufferlist &bl) const
+void pg_info_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(32, 26, bl);
encode(pgid.pgid, bl);
ENCODE_FINISH(bl);
}
-void pg_info_t::decode(bufferlist::const_iterator &bl)
+void pg_info_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(32, bl);
decode(pgid.pgid, bl);
}
// -- pg_notify_t --
-void pg_notify_t::encode(bufferlist &bl) const
+void pg_notify_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(2, 2, bl);
encode(query_epoch, bl);
ENCODE_FINISH(bl);
}
-void pg_notify_t::decode(bufferlist::const_iterator &bl)
+void pg_notify_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(2, bl);
decode(query_epoch, bl);
// -- pg_interval_t --
-void PastIntervals::pg_interval_t::encode(bufferlist& bl) const
+void PastIntervals::pg_interval_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(4, 2, bl);
encode(first, bl);
ENCODE_FINISH(bl);
}
-void PastIntervals::pg_interval_t::decode(bufferlist::const_iterator& bl)
+void PastIntervals::pg_interval_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
decode(first, bl);
f->dump_unsigned("last", last);
f->dump_int("maybe_went_rw", maybe_went_rw ? 1 : 0);
f->open_array_section("up");
- for (vector<int>::const_iterator p = up.begin(); p != up.end(); ++p)
+ for (auto p = up.cbegin(); p != up.cend(); ++p)
f->dump_int("osd", *p);
f->close_section();
f->open_array_section("acting");
- for (vector<int>::const_iterator p = acting.begin(); p != acting.end(); ++p)
+ for (auto p = acting.cbegin(); p != acting.cend(); ++p)
f->dump_int("osd", *p);
f->close_section();
f->dump_int("primary", primary);
f->dump_stream("acting") << acting;
f->close_section();
}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(first, bl);
encode(last, bl);
encode(acting, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(1, bl);
decode(first, bl);
decode(last, bl);
return out << "([" << first << "," << last
<< "] intervals=" << intervals << ")";
}
- void encode(bufferlist &bl) const override {
+ void encode(ceph::buffer::list &bl) const override {
ENCODE_START(1, 1, bl);
encode(first, bl);
encode(last, bl);
encode(intervals, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) override {
+ void decode(ceph::buffer::list::const_iterator &bl) override {
DECODE_START(1, bl);
decode(first, bl);
decode(last, bl);
<< ")";
}
-void PastIntervals::decode(bufferlist::const_iterator &bl)
+void PastIntervals::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
__u8 type = 0;
i.up_primary = old_up_primary;
unsigned num_acting = 0;
- for (vector<int>::const_iterator p = i.acting.begin(); p != i.acting.end();
- ++p)
+ for (auto p = i.acting.cbegin(); p != i.acting.cend(); ++p)
if (*p != CRUSH_ITEM_NONE)
++num_acting;
const OSDMap &osdmap,
const DoutPrefixProvider *dpp) const
{
- for (set<pg_shard_t>::iterator p = probe.begin();
- p != probe.end();
- ++p) {
+ for (auto p = probe.begin(); p != probe.end(); ++p) {
int o = p->osd;
// did someone in the prior set go down?
}
// did a down osd in cur get (re)marked as lost?
- map<int, epoch_t>::const_iterator r = blocked_by.find(o);
+ auto r = blocked_by.find(o);
if (r != blocked_by.end()) {
if (!osdmap.exists(o)) {
ldpp_dout(dpp, 10) << "affected_by_map osd." << o << " no longer exists" << dendl;
}
// did someone in the prior down set go up?
- for (set<int>::const_iterator p = down.begin();
- p != down.end();
- ++p) {
+ for (auto p = down.cbegin(); p != down.cend(); ++p) {
int o = *p;
if (osdmap.is_up(o)) {
return true;
}
// did a down osd in down get (re)marked as lost?
- map<int, epoch_t>::const_iterator r = blocked_by.find(o);
+ auto r = blocked_by.find(o);
if (r != blocked_by.end()) {
if (osdmap.get_info(o).lost_at != r->second) {
ldpp_dout(dpp, 10) << "affected_by_map osd." << o << " (re)marked as lost" << dendl;
// -- pg_query_t --
-void pg_query_t::encode(bufferlist &bl, uint64_t features) const {
+void pg_query_t::encode(ceph::buffer::list &bl, uint64_t features) const {
ENCODE_START(3, 3, bl);
encode(type, bl);
encode(since, bl);
ENCODE_FINISH(bl);
}
-void pg_query_t::decode(bufferlist::const_iterator &bl) {
+void pg_query_t::decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(3, bl);
decode(type, bl);
decode(since, bl);
break;
}
case SETATTRS: {
- map<string, boost::optional<bufferlist> > attrs;
+ map<string, boost::optional<ceph::buffer::list> > attrs;
decode(attrs, bp);
visitor->setattrs(attrs);
break;
f->dump_unsigned("old_size", old_size);
f->close_section();
}
- void setattrs(map<string, boost::optional<bufferlist> > &attrs) override {
+ void setattrs(map<string, boost::optional<ceph::buffer::list> > &attrs) override {
f->open_object_section("op");
f->dump_string("code", "SETATTRS");
f->open_array_section("attrs");
- for (map<string, boost::optional<bufferlist> >::iterator i = attrs.begin();
- i != attrs.end();
- ++i) {
+ for (auto i = attrs.begin(); i != attrs.end(); ++i) {
f->dump_string("attr_name", i->first);
}
f->close_section();
void ObjectModDesc::generate_test_instances(list<ObjectModDesc*>& o)
{
- map<string, boost::optional<bufferlist> > attrs;
+ map<string, boost::optional<ceph::buffer::list> > attrs;
attrs[OI_ATTR];
attrs[SS_ATTR];
attrs["asdf"];
o.back()->append(1000);
}
-void ObjectModDesc::encode(bufferlist &_bl) const
+void ObjectModDesc::encode(ceph::buffer::list &_bl) const
{
ENCODE_START(max_required_version, max_required_version, _bl);
encode(can_local_rollback, _bl);
encode(bl, _bl);
ENCODE_FINISH(_bl);
}
-void ObjectModDesc::decode(bufferlist::const_iterator &_bl)
+void ObjectModDesc::decode(ceph::buffer::list::const_iterator &_bl)
{
DECODE_START(2, _bl);
max_required_version = struct_v;
decode(can_local_rollback, _bl);
decode(rollback_info_completed, _bl);
decode(bl, _bl);
- // ensure bl does not pin a larger buffer in memory
+ // ensure bl does not pin a larger ceph::buffer in memory
bl.rebuild();
bl.reassign_to_mempool(mempool::mempool_osd_pglog);
DECODE_FINISH(_bl);
return version.get_key_name();
}
-void pg_log_entry_t::encode_with_checksum(bufferlist& bl) const
+void pg_log_entry_t::encode_with_checksum(ceph::buffer::list& bl) const
{
using ceph::encode;
- bufferlist ebl(sizeof(*this)*2);
+ ceph::buffer::list ebl(sizeof(*this)*2);
this->encode(ebl);
__u32 crc = ebl.crc32c(0);
encode(ebl, bl);
encode(crc, bl);
}
-void pg_log_entry_t::decode_with_checksum(bufferlist::const_iterator& p)
+void pg_log_entry_t::decode_with_checksum(ceph::buffer::list::const_iterator& p)
{
using ceph::decode;
- bufferlist bl;
+ ceph::buffer::list bl;
decode(bl, p);
__u32 crc;
decode(crc, p);
if (crc != bl.crc32c(0))
- throw buffer::malformed_input("bad checksum on pg_log_entry_t");
+ throw ceph::buffer::malformed_input("bad checksum on pg_log_entry_t");
auto q = bl.cbegin();
this->decode(q);
}
-void pg_log_entry_t::encode(bufferlist &bl) const
+void pg_log_entry_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(12, 4, bl);
encode(op, bl);
ENCODE_FINISH(bl);
}
-void pg_log_entry_t::decode(bufferlist::const_iterator &bl)
+void pg_log_entry_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START_LEGACY_COMPAT_LEN(12, 4, 4, bl);
decode(op, bl);
if (struct_v >= 7 || // for v >= 7, this is for all ops.
op == CLONE) { // for v < 7, it's only present for CLONE.
decode(snaps, bl);
- // ensure snaps does not pin a larger buffer in memory
+ // ensure snaps does not pin a larger ceph::buffer in memory
snaps.rebuild();
snaps.reassign_to_mempool(mempool::mempool_osd_pglog);
}
f->dump_int("return_code", return_code);
if (snaps.length() > 0) {
vector<snapid_t> v;
- bufferlist c = snaps;
+ ceph::buffer::list c = snaps;
auto p = c.cbegin();
try {
using ceph::decode;
v.clear();
}
f->open_object_section("snaps");
- for (vector<snapid_t>::iterator p = v.begin(); p != v.end(); ++p)
+ for (auto p = v.begin(); p != v.end(); ++p)
f->dump_unsigned("snap", *p);
f->close_section();
}
<< " " << e.return_code;
if (e.snaps.length()) {
vector<snapid_t> snaps;
- bufferlist c = e.snaps;
+ ceph::buffer::list c = e.snaps;
auto p = c.cbegin();
try {
decode(snaps, p);
return key;
}
-void pg_log_dup_t::encode(bufferlist &bl) const
+void pg_log_dup_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(reqid, bl);
ENCODE_FINISH(bl);
}
-void pg_log_dup_t::decode(bufferlist::const_iterator &bl)
+void pg_log_dup_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(reqid, bl);
out.log.clear();
reject.log.clear();
- for (list<pg_log_entry_t>::const_iterator i = in.log.begin();
- i != in.log.end(); ++i) {
+ for (auto i = in.log.cbegin(); i != in.log.cend(); ++i) {
// Reject pg log entries for temporary objects
if (i->soid.is_temp()) {
}
}
-void pg_log_t::encode(bufferlist& bl) const
+void pg_log_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(7, 3, bl);
encode(head, bl);
ENCODE_FINISH(bl);
}
-void pg_log_t::decode(bufferlist::const_iterator &bl, int64_t pool)
+void pg_log_t::decode(ceph::buffer::list::const_iterator &bl, int64_t pool)
{
DECODE_START_LEGACY_COMPAT_LEN(7, 3, 3, bl);
decode(head, bl);
// handle hobject_t format change
if (struct_v < 4) {
- for (list<pg_log_entry_t>::iterator i = log.begin();
- i != log.end();
- ++i) {
+ for (auto i = log.begin(); i != log.end(); ++i) {
if (!i->soid.is_max() && i->soid.pool == -1)
i->soid.pool = pool;
}
f->dump_stream("head") << head;
f->dump_stream("tail") << tail;
f->open_array_section("log");
- for (list<pg_log_entry_t>::const_iterator p = log.begin(); p != log.end(); ++p) {
+ for (auto p = log.cbegin(); p != log.cend(); ++p) {
f->open_object_section("entry");
p->dump(f);
f->close_section();
o.back()->tail = eversion_t(3,4);
list<pg_log_entry_t*> e;
pg_log_entry_t::generate_test_instances(e);
- for (list<pg_log_entry_t*>::iterator p = e.begin(); p != e.end(); ++p)
+ for (auto p = e.begin(); p != e.end(); ++p)
o.back()->log.push_back(**p);
}
can_rollback_to = other.can_rollback_to;
head = other.head;
tail = other.tail;
- for (list<pg_log_entry_t>::const_reverse_iterator i = other.log.rbegin();
- i != other.log.rend();
- ++i) {
+ for (auto i = other.log.crbegin(); i != other.log.crend(); ++i) {
ceph_assert(i->version > other.tail);
if (i->version <= v) {
// make tail accurate.
void pg_log_t::copy_range(const pg_log_t &other, eversion_t from, eversion_t to)
{
can_rollback_to = other.can_rollback_to;
- list<pg_log_entry_t>::const_reverse_iterator i = other.log.rbegin();
+ auto i = other.log.crbegin();
ceph_assert(i != other.log.rend());
while (i->version > to) {
++i;
int n = 0;
head = other.head;
tail = other.tail;
- for (list<pg_log_entry_t>::const_reverse_iterator i = other.log.rbegin();
- i != other.log.rend();
- ++i) {
+ for (auto i = other.log.crbegin(); i != other.log.crend(); ++i) {
if (n++ >= max) {
tail = i->version;
break;
ostream& pg_log_t::print(ostream& out) const
{
out << *this << std::endl;
- for (list<pg_log_entry_t>::const_iterator p = log.begin();
- p != log.end();
- ++p)
+ for (auto p = log.cbegin(); p != log.cend(); ++p)
out << *p << std::endl;
for (const auto& entry : dups) {
out << " dup entry: " << entry << std::endl;
// -- object_copy_cursor_t --
-void object_copy_cursor_t::encode(bufferlist& bl) const
+void object_copy_cursor_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(1, 1, bl);
encode(attr_complete, bl);
ENCODE_FINISH(bl);
}
-void object_copy_cursor_t::decode(bufferlist::const_iterator &bl)
+void object_copy_cursor_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(attr_complete, bl);
// -- object_copy_data_t --
-void object_copy_data_t::encode(bufferlist& bl, uint64_t features) const
+void object_copy_data_t::encode(ceph::buffer::list& bl, uint64_t features) const
{
ENCODE_START(8, 5, bl);
encode(size, bl);
ENCODE_FINISH(bl);
}
-void object_copy_data_t::decode(bufferlist::const_iterator& bl)
+void object_copy_data_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START(7, bl);
if (struct_v < 5) {
decode(attrs, bl);
decode(data, bl);
{
- map<string,bufferlist> omap;
+ map<string,ceph::buffer::list> omap;
decode(omap, bl);
omap_data.clear();
if (!omap.empty()) {
list<object_copy_cursor_t*> cursors;
object_copy_cursor_t::generate_test_instances(cursors);
- list<object_copy_cursor_t*>::iterator ci = cursors.begin();
+ auto ci = cursors.begin();
o.back()->cursor = **(ci++);
o.push_back(new object_copy_data_t());
o.push_back(new object_copy_data_t());
o.back()->size = 1234;
o.back()->mtime.set_from_double(1234);
- bufferptr bp("there", 5);
- bufferlist bl;
+ ceph::buffer::ptr bp("there", 5);
+ ceph::buffer::list bl;
bl.push_back(bp);
o.back()->attrs["hello"] = bl;
- bufferptr bp2("not", 3);
- bufferlist bl2;
+ ceph::buffer::ptr bp2("not", 3);
+ ceph::buffer::list bl2;
bl2.push_back(bp2);
- map<string,bufferlist> omap;
+ map<string,ceph::buffer::list> omap;
omap["why"] = bl2;
using ceph::encode;
encode(omap, o.back()->omap_data);
- bufferptr databp("iamsomedatatocontain", 20);
+ ceph::buffer::ptr databp("iamsomedatatocontain", 20);
o.back()->data.push_back(databp);
o.back()->omap_header.append("this is an omap header");
o.back()->snaps.push_back(123);
f->close_section(); // cursor
f->dump_int("size", size);
f->dump_stream("mtime") << mtime;
- /* we should really print out the attrs here, but bufferlist
+ /* we should really print out the attrs here, but ceph::buffer::list
const-correctness prevents that */
f->dump_int("attrs_size", attrs.size());
f->dump_int("flags", flags);
f->dump_int("omap_header_length", omap_header.length());
f->dump_int("data_length", data.length());
f->open_array_section("snaps");
- for (vector<snapid_t>::const_iterator p = snaps.begin();
- p != snaps.end(); ++p)
+ for (auto p = snaps.cbegin(); p != snaps.cend(); ++p)
f->dump_unsigned("snap", *p);
f->close_section();
f->open_array_section("reqids");
// -- pg_create_t --
-void pg_create_t::encode(bufferlist &bl) const
+void pg_create_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(created, bl);
ENCODE_FINISH(bl);
}
-void pg_create_t::decode(bufferlist::const_iterator &bl)
+void pg_create_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(created, bl);
// -- pg_hit_set_info_t --
-void pg_hit_set_info_t::encode(bufferlist& bl) const
+void pg_hit_set_info_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(2, 1, bl);
encode(begin, bl);
ENCODE_FINISH(bl);
}
-void pg_hit_set_info_t::decode(bufferlist::const_iterator& p)
+void pg_hit_set_info_t::decode(ceph::buffer::list::const_iterator& p)
{
DECODE_START(2, p);
decode(begin, p);
// -- pg_hit_set_history_t --
-void pg_hit_set_history_t::encode(bufferlist& bl) const
+void pg_hit_set_history_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(1, 1, bl);
encode(current_last_update, bl);
ENCODE_FINISH(bl);
}
-void pg_hit_set_history_t::decode(bufferlist::const_iterator& p)
+void pg_hit_set_history_t::decode(ceph::buffer::list::const_iterator& p)
{
DECODE_START(1, p);
decode(current_last_update, p);
{
f->dump_stream("current_last_update") << current_last_update;
f->open_array_section("history");
- for (list<pg_hit_set_info_t>::const_iterator p = history.begin();
- p != history.end(); ++p) {
+ for (auto p = history.cbegin(); p != history.cend(); ++p) {
f->open_object_section("info");
p->dump(f);
f->close_section();
// -- OSDSuperblock --
-void OSDSuperblock::encode(bufferlist &bl) const
+void OSDSuperblock::encode(ceph::buffer::list &bl) const
{
ENCODE_START(8, 5, bl);
encode(cluster_fsid, bl);
ENCODE_FINISH(bl);
}
-void OSDSuperblock::decode(bufferlist::const_iterator &bl)
+void OSDSuperblock::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START_LEGACY_COMPAT_LEN(8, 5, 5, bl);
if (struct_v < 3) {
// -- SnapSet --
-void SnapSet::encode(bufferlist& bl) const
+void SnapSet::encode(ceph::buffer::list& bl) const
{
ENCODE_START(3, 2, bl);
encode(seq, bl);
ENCODE_FINISH(bl);
}
-void SnapSet::decode(bufferlist::const_iterator& bl)
+void SnapSet::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
decode(seq, bl);
sc.dump(f);
f->close_section();
f->open_array_section("clones");
- for (vector<snapid_t>::const_iterator p = clones.begin(); p != clones.end(); ++p) {
+ for (auto p = clones.cbegin(); p != clones.cend(); ++p) {
f->open_object_section("clone");
f->dump_unsigned("snap", *p);
auto cs = clone_size.find(*p);
seq = ss.seq;
set<snapid_t> _snaps;
set<snapid_t> _clones;
- for (vector<librados::clone_info_t>::const_iterator p = ss.clones.begin();
- p != ss.clones.end();
- ++p) {
+ for (auto p = ss.clones.cbegin(); p != ss.clones.cend(); ++p) {
if (p->cloneid != librados::SNAP_HEAD) {
_clones.insert(p->cloneid);
_snaps.insert(p->snaps.begin(), p->snaps.end());
clone_size[p->cloneid] = p->size;
clone_overlap[p->cloneid]; // the entry must exist, even if it's empty.
- for (vector<pair<uint64_t, uint64_t> >::const_iterator q =
- p->overlap.begin(); q != p->overlap.end(); ++q)
+ for (auto q = p->overlap.cbegin(); q != p->overlap.cend(); ++q)
clone_overlap[p->cloneid].insert(q->first, q->second);
if (!legacy) {
// p->snaps is ascending; clone_snaps is descending
// ascending
clones.clear();
clones.reserve(_clones.size());
- for (set<snapid_t>::iterator p = _clones.begin(); p != _clones.end(); ++p)
+ for (auto p = _clones.begin(); p != _clones.end(); ++p)
clones.push_back(*p);
// descending
snaps.clear();
snaps.reserve(_snaps.size());
- for (set<snapid_t>::reverse_iterator p = _snaps.rbegin();
+ for (auto p = _snaps.rbegin();
p != _snaps.rend(); ++p)
snaps.push_back(*p);
}
{
vector<snapid_t> oldsnaps;
oldsnaps.swap(snaps);
- for (vector<snapid_t>::const_iterator i = oldsnaps.begin();
- i != oldsnaps.end();
- ++i) {
+ for (auto i = oldsnaps.cbegin(); i != oldsnaps.cend(); ++i) {
if (!pinfo.is_removed_snap(*i))
snaps.push_back(*i);
}
// -- watch_info_t --
-void watch_info_t::encode(bufferlist& bl, uint64_t features) const
+void watch_info_t::encode(ceph::buffer::list& bl, uint64_t features) const
{
ENCODE_START(4, 3, bl);
encode(cookie, bl);
ENCODE_FINISH(bl);
}
-void watch_info_t::decode(bufferlist::const_iterator& bl)
+void watch_info_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(4, 3, 3, bl);
decode(cookie, bl);
// -- chunk_info_t --
-void chunk_info_t::encode(bufferlist& bl) const
+void chunk_info_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(1, 1, bl);
encode(offset, bl);
ENCODE_FINISH(bl);
}
-void chunk_info_t::decode(bufferlist::const_iterator& bl)
+void chunk_info_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START(1, bl);
decode(offset, bl);
// -- object_manifest_t --
-void object_manifest_t::encode(bufferlist& bl) const
+void object_manifest_t::encode(ceph::buffer::list& bl) const
{
ENCODE_START(1, 1, bl);
encode(type, bl);
encode(redirect_target, bl);
break;
case TYPE_CHUNKED:
- encode(chunk_map, bl);
+ encode(chunk_map, bl);
break;
default:
ceph_abort();
ENCODE_FINISH(bl);
}
-void object_manifest_t::decode(bufferlist::const_iterator& bl)
+void object_manifest_t::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START(1, bl);
decode(type, bl);
omap_digest = other.omap_digest;
}
-void object_info_t::encode(bufferlist& bl, uint64_t features) const
+void object_info_t::encode(ceph::buffer::list& bl, uint64_t features) const
{
object_locator_t myoloc(soid);
map<entity_name_t, watch_info_t> old_watchers;
- for (map<pair<uint64_t, entity_name_t>, watch_info_t>::const_iterator i =
- watchers.begin();
- i != watchers.end();
- ++i) {
+ for (auto i = watchers.cbegin(); i != watchers.cend(); ++i) {
old_watchers.insert(make_pair(i->first.second, i->second));
}
ENCODE_START(17, 8, bl);
ENCODE_FINISH(bl);
}
-void object_info_t::decode(bufferlist::const_iterator& bl)
+void object_info_t::decode(ceph::buffer::list::const_iterator& bl)
{
object_locator_t myoloc;
DECODE_START_LEGACY_COMPAT_LEN(17, 8, 8, bl);
if (struct_v >= 11) {
decode(watchers, bl);
} else {
- for (map<entity_name_t, watch_info_t>::iterator i = old_watchers.begin();
- i != old_watchers.end();
- ++i) {
+ for (auto i = old_watchers.begin(); i != old_watchers.end(); ++i) {
watchers.insert(
make_pair(
make_pair(i->second.cookie, i->first), i->second));
f->dump_unsigned("alloc_hint_flags", alloc_hint_flags);
f->dump_object("manifest", manifest);
f->open_object_section("watchers");
- for (map<pair<uint64_t, entity_name_t>,watch_info_t>::const_iterator p =
- watchers.begin(); p != watchers.end(); ++p) {
+ for (auto p = watchers.cbegin(); p != watchers.cend(); ++p) {
stringstream ss;
ss << p->first.second;
f->open_object_section(ss.str().c_str());
}
// -- ObjectRecovery --
-void ObjectRecoveryProgress::encode(bufferlist &bl) const
+void ObjectRecoveryProgress::encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(first, bl);
ENCODE_FINISH(bl);
}
-void ObjectRecoveryProgress::decode(bufferlist::const_iterator &bl)
+void ObjectRecoveryProgress::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(first, bl);
f->dump_string("omap_recovered_to", omap_recovered_to);
}
-void ObjectRecoveryInfo::encode(bufferlist &bl, uint64_t features) const
+void ObjectRecoveryInfo::encode(ceph::buffer::list &bl, uint64_t features) const
{
ENCODE_START(2, 1, bl);
encode(soid, bl);
ENCODE_FINISH(bl);
}
-void ObjectRecoveryInfo::decode(bufferlist::const_iterator &bl,
+void ObjectRecoveryInfo::decode(ceph::buffer::list::const_iterator &bl,
int64_t pool)
{
DECODE_START(2, bl);
soid.pool = pool;
map<hobject_t, interval_set<uint64_t>> tmp;
tmp.swap(clone_subset);
- for (map<hobject_t, interval_set<uint64_t>>::iterator i = tmp.begin();
- i != tmp.end();
- ++i) {
+ for (auto i = tmp.begin(); i != tmp.end(); ++i) {
hobject_t first(i->first);
if (!first.is_max() && first.pool == -1)
first.pool = pool;
o.back()->soid = hobject_t(sobject_t("asdf", CEPH_NOSNAP));
}
-void PushReplyOp::encode(bufferlist &bl) const
+void PushReplyOp::encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
encode(soid, bl);
ENCODE_FINISH(bl);
}
-void PushReplyOp::decode(bufferlist::const_iterator &bl)
+void PushReplyOp::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(soid, bl);
o.back()->recovery_info.version = eversion_t(0, 0);
}
-void PullOp::encode(bufferlist &bl, uint64_t features) const
+void PullOp::encode(ceph::buffer::list &bl, uint64_t features) const
{
ENCODE_START(1, 1, bl);
encode(soid, bl);
ENCODE_FINISH(bl);
}
-void PullOp::decode(bufferlist::const_iterator &bl)
+void PullOp::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(soid, bl);
o.back()->version = eversion_t(0, 0);
}
-void PushOp::encode(bufferlist &bl, uint64_t features) const
+void PushOp::encode(ceph::buffer::list &bl, uint64_t features) const
{
ENCODE_START(1, 1, bl);
encode(soid, bl);
ENCODE_FINISH(bl);
}
-void PushOp::decode(bufferlist::const_iterator &bl)
+void PushOp::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START(1, bl);
decode(soid, bl);
uint64_t PushOp::cost(CephContext *cct) const
{
uint64_t cost = data_included.size();
- for (map<string, bufferlist>::const_iterator i =
- omap_entries.begin();
- i != omap_entries.end();
- ++i) {
+ for (auto i = omap_entries.cbegin(); i != omap_entries.cend(); ++i) {
cost += i->second.length();
}
cost += cct->_conf->osd_push_per_object_cost;
ceph_assert(valid_through == l.incr_since);
valid_through = l.valid_through;
- for (map<hobject_t,object>::const_iterator p = l.objects.begin();
- p != l.objects.end();
- ++p){
+ for (auto p = l.objects.cbegin(); p != l.objects.cend(); ++p){
if (p->second.negative) {
- map<hobject_t,object>::iterator q = objects.find(p->first);
+ auto q = objects.find(p->first);
if (q != objects.end()) {
objects.erase(q);
}
}
}
-void ScrubMap::encode(bufferlist& bl) const
+void ScrubMap::encode(ceph::buffer::list& bl) const
{
ENCODE_START(3, 2, bl);
encode(objects, bl);
encode((__u32)0, bl); // used to be attrs; now deprecated
- bufferlist old_logbl; // not used
+ ceph::buffer::list old_logbl; // not used
encode(old_logbl, bl);
encode(valid_through, bl);
encode(incr_since, bl);
ENCODE_FINISH(bl);
}
-void ScrubMap::decode(bufferlist::const_iterator& bl, int64_t pool)
+void ScrubMap::decode(ceph::buffer::list::const_iterator& bl, int64_t pool)
{
DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
decode(objects, bl);
map<string,string> attrs; // deprecated
decode(attrs, bl);
}
- bufferlist old_logbl; // not used
+ ceph::buffer::list old_logbl; // not used
decode(old_logbl, bl);
decode(valid_through, bl);
decode(incr_since, bl);
if (struct_v < 3) {
map<hobject_t, object> tmp;
tmp.swap(objects);
- for (map<hobject_t, object>::iterator i = tmp.begin();
- i != tmp.end();
- ++i) {
+ for (auto i = tmp.begin(); i != tmp.end(); ++i) {
hobject_t first(i->first);
if (!first.is_max() && first.pool == -1)
first.pool = pool;
f->dump_stream("valid_through") << valid_through;
f->dump_stream("incremental_since") << incr_since;
f->open_array_section("objects");
- for (map<hobject_t,object>::const_iterator p = objects.begin(); p != objects.end(); ++p) {
+ for (auto p = objects.cbegin(); p != objects.cend(); ++p) {
f->open_object_section("object");
f->dump_string("name", p->first.oid.name);
f->dump_unsigned("hash", p->first.get_hash());
// -- ScrubMap::object --
-void ScrubMap::object::encode(bufferlist& bl) const
+void ScrubMap::object::encode(ceph::buffer::list& bl) const
{
bool compat_read_error = read_error || ec_hash_mismatch || ec_size_mismatch;
ENCODE_START(10, 7, bl);
ENCODE_FINISH(bl);
}
-void ScrubMap::object::decode(bufferlist::const_iterator& bl)
+void ScrubMap::object::decode(ceph::buffer::list::const_iterator& bl)
{
DECODE_START(10, bl);
decode(size, bl);
f->dump_int("size", size);
f->dump_int("negative", negative);
f->open_array_section("attrs");
- for (map<string,bufferptr>::const_iterator p = attrs.begin(); p != attrs.end(); ++p) {
+ for (auto p = attrs.cbegin(); p != attrs.cend(); ++p) {
f->open_object_section("attr");
f->dump_string("name", p->first);
f->dump_int("length", p->second.length());
o.back()->negative = true;
o.push_back(new object);
o.back()->size = 123;
- o.back()->attrs["foo"] = buffer::copy("foo", 3);
- o.back()->attrs["bar"] = buffer::copy("barval", 6);
+ o.back()->attrs["foo"] = ceph::buffer::copy("foo", 3);
+ o.back()->attrs["bar"] = ceph::buffer::copy("barval", 6);
}
// -- OSDOp --
}
-void OSDOp::split_osd_op_vector_in_data(vector<OSDOp>& ops, bufferlist& in)
+void OSDOp::split_osd_op_vector_in_data(vector<OSDOp>& ops, ceph::buffer::list& in)
{
- bufferlist::iterator datap = in.begin();
+ ceph::buffer::list::iterator datap = in.begin();
for (unsigned i = 0; i < ops.size(); i++) {
if (ops[i].op.payload_len) {
datap.copy(ops[i].op.payload_len, ops[i].indata);
}
}
-void OSDOp::merge_osd_op_vector_in_data(vector<OSDOp>& ops, bufferlist& out)
+void OSDOp::merge_osd_op_vector_in_data(vector<OSDOp>& ops, ceph::buffer::list& out)
{
for (unsigned i = 0; i < ops.size(); i++) {
if (ops[i].indata.length()) {
}
}
-void OSDOp::split_osd_op_vector_out_data(vector<OSDOp>& ops, bufferlist& in)
+void OSDOp::split_osd_op_vector_out_data(vector<OSDOp>& ops, ceph::buffer::list& in)
{
- bufferlist::iterator datap = in.begin();
+ auto datap = in.begin();
for (unsigned i = 0; i < ops.size(); i++) {
if (ops[i].op.payload_len) {
datap.copy(ops[i].op.payload_len, ops[i].outdata);
}
}
-void OSDOp::merge_osd_op_vector_out_data(vector<OSDOp>& ops, bufferlist& out)
+void OSDOp::merge_osd_op_vector_out_data(vector<OSDOp>& ops, ceph::buffer::list& out)
{
for (unsigned i = 0; i < ops.size(); i++) {
if (ops[i].outdata.length()) {
if (ceph_osd_op_type_attr(op.op.op) &&
op.op.xattr.name_len &&
op.indata.length() >= op.op.xattr.name_len) {
- bufferptr bp(op.op.xattr.name_len);
- bufferlist bl;
+ ceph::buffer::ptr bp(op.op.xattr.name_len);
+ ceph::buffer::list bl;
bl.append(bp);
bl.copy_in(0, op.op.xattr.name_len, op.indata);
op.indata.claim(bl);
op.indata.length() >
(op.op.cls.class_len + op.op.cls.method_len)) {
__u8 len = op.op.cls.class_len + op.op.cls.method_len;
- bufferptr bp(len);
- bufferlist bl;
+ ceph::buffer::ptr bp(len);
+ ceph::buffer::list bl;
bl.append(bp);
bl.copy_in(0, len, op.indata);
op.indata.claim(bl);
#ifndef CEPH_OSD_TYPES_H
#define CEPH_OSD_TYPES_H
+#include <atomic>
#include <sstream>
-#include <stdio.h>
+#include <cstdio>
#include <memory>
#include <string_view>
+
#include <boost/scoped_ptr.hpp>
#include <boost/optional/optional_io.hpp>
#include <boost/variant.hpp>
#include "include/cmp.h"
#include "librados/ListObjectImpl.h"
#include "compressor/Compressor.h"
-#include <atomic>
#define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v026"
typedef hobject_t collection_list_handle_t;
-/// convert a single CPEH_OSD_FLAG_* to a string
+/// convert a single CPEH_OSD_FLAG_* to a std::string
const char *ceph_osd_flag_name(unsigned flag);
-/// convert a single CEPH_OSD_OF_FLAG_* to a string
+/// convert a single CEPH_OSD_OF_FLAG_* to a std::string
const char *ceph_osd_op_flag_name(unsigned flag);
-/// convert CEPH_OSD_FLAG_* op flags to a string
-string ceph_osd_flag_string(unsigned flags);
-/// conver CEPH_OSD_OP_FLAG_* op flags to a string
-string ceph_osd_op_flag_string(unsigned flags);
-/// conver CEPH_OSD_ALLOC_HINT_FLAG_* op flags to a string
-string ceph_osd_alloc_hint_flag_string(unsigned flags);
+/// convert CEPH_OSD_FLAG_* op flags to a std::string
+std::string ceph_osd_flag_string(unsigned flags);
+/// conver CEPH_OSD_OP_FLAG_* op flags to a std::string
+std::string ceph_osd_op_flag_string(unsigned flags);
+/// conver CEPH_OSD_ALLOC_HINT_FLAG_* op flags to a std::string
+std::string ceph_osd_alloc_hint_flag_string(unsigned flags);
-typedef map<string,string> osd_alert_list_t;
+typedef std::map<std::string,std::string> osd_alert_list_t;
/// map osd id -> alert_list_t
-typedef map<int, osd_alert_list_t> osd_alerts_t;
-void dump(Formatter* f, const osd_alerts_t& alerts);
+typedef std::map<int, osd_alert_list_t> osd_alerts_t;
+void dump(ceph::Formatter* f, const osd_alerts_t& alerts);
/**
* osd request identifier
denc(v.inc, p);
DENC_FINISH(p);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<osd_reqid_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<osd_reqid_t*>& o);
};
WRITE_CLASS_DENC(osd_reqid_t)
bool is_undefined() const {
return osd == -1;
}
- string get_osd() const { return (osd == NO_OSD ? "NONE" : to_string(osd)); }
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const {
+ std::string get_osd() const { return (osd == NO_OSD ? "NONE" : std::to_string(osd)); }
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const {
f->dump_unsigned("osd", osd);
if (shard != shard_id_t::NO_SHARD) {
f->dump_unsigned("shard", shard);
WRITE_CLASS_ENCODER(pg_shard_t)
WRITE_EQ_OPERATORS_2(pg_shard_t, osd, shard)
WRITE_CMP_OPERATORS_2(pg_shard_t, osd, shard)
-ostream &operator<<(ostream &lhs, const pg_shard_t &rhs);
+std::ostream& operator<<(std::ostream &lhs, const pg_shard_t &rhs);
class IsPGRecoverablePredicate {
public:
/**
* have encodes the shards available
*/
- virtual bool operator()(const set<pg_shard_t> &have) const = 0;
+ virtual bool operator()(const std::set<pg_shard_t> &have) const = 0;
virtual ~IsPGRecoverablePredicate() {}
};
/**
* have encodes the shards available
*/
- virtual bool operator()(const set<pg_shard_t> &have) const = 0;
+ virtual bool operator()(const std::set<pg_shard_t> &have) const = 0;
virtual ~IsPGReadablePredicate() {}
};
-inline ostream& operator<<(ostream& out, const osd_reqid_t& r) {
+inline std::ostream& operator<<(std::ostream& out, const osd_reqid_t& r) {
return out << r.name << "." << r.inc << ":" << r.tid;
}
struct object_locator_t {
// You specify either the hash or the key -- not both
int64_t pool; ///< pool id
- string key; ///< key string (if non-empty)
- string nspace; ///< namespace
+ std::string key; ///< key std::string (if non-empty)
+ std::string nspace; ///< namespace
int64_t hash; ///< hash position (if >= 0)
explicit object_locator_t()
: pool(po), hash(-1) {}
explicit object_locator_t(int64_t po, int64_t ps)
: pool(po), hash(ps) {}
- explicit object_locator_t(int64_t po, string ns)
+ explicit object_locator_t(int64_t po, std::string ns)
: pool(po), nspace(ns), hash(-1) {}
- explicit object_locator_t(int64_t po, string ns, int64_t ps)
+ explicit object_locator_t(int64_t po, std::string ns, int64_t ps)
: pool(po), nspace(ns), hash(ps) {}
- explicit object_locator_t(int64_t po, string ns, string s)
+ explicit object_locator_t(int64_t po, std::string ns, std::string s)
: pool(po), key(s), nspace(ns), hash(-1) {}
explicit object_locator_t(const hobject_t& soid)
: pool(soid.pool), key(soid.get_key()), nspace(soid.nspace), hash(-1) {}
return pool == -1;
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<object_locator_t*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<object_locator_t*>& o);
};
WRITE_CLASS_ENCODER(object_locator_t)
return !(l == r);
}
-inline ostream& operator<<(ostream& out, const object_locator_t& loc)
+inline std::ostream& operator<<(std::ostream& out, const object_locator_t& loc)
{
out << "@" << loc.pool;
if (loc.nspace.length())
struct request_redirect_t {
private:
object_locator_t redirect_locator; ///< this is authoritative
- string redirect_object; ///< If non-empty, the request goes to this object name
+ std::string redirect_object; ///< If non-empty, the request goes to this object name
- friend ostream& operator<<(ostream& out, const request_redirect_t& redir);
+ friend std::ostream& operator<<(std::ostream& out, const request_redirect_t& redir);
public:
request_redirect_t() {}
explicit request_redirect_t(const object_locator_t& rloc) :
redirect_locator(rloc) {}
explicit request_redirect_t(const object_locator_t& orig,
- const string& robj) :
+ const std::string& robj) :
redirect_locator(orig), redirect_object(robj) {}
bool empty() const { return redirect_locator.empty() &&
redirect_object.empty(); }
- void combine_with_locator(object_locator_t& orig, string& obj) const {
+ void combine_with_locator(object_locator_t& orig, std::string& obj) const {
orig = redirect_locator;
if (!redirect_object.empty())
obj = redirect_object;
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<request_redirect_t*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<request_redirect_t*>& o);
};
WRITE_CLASS_ENCODER(request_redirect_t)
-inline ostream& operator<<(ostream& out, const request_redirect_t& redir) {
+inline std::ostream& operator<<(std::ostream& out, const request_redirect_t& redir) {
out << "object " << redir.redirect_object << ", locator{" << redir.redirect_locator << "}";
return out;
}
// old (v1) pg_t encoding (wrap old struct ceph_pg)
struct old_pg_t {
ceph_pg v;
- void encode(bufferlist& bl) const {
- ::encode_raw(v, bl);
+ void encode(ceph::buffer::list& bl) const {
+ ceph::encode_raw(v, bl);
}
- void decode(bufferlist::const_iterator& bl) {
- ::decode_raw(v, bl);
+ void decode(ceph::buffer::list::const_iterator& bl) {
+ ceph::decode_raw(v, bl);
}
};
WRITE_CLASS_ENCODER(old_pg_t)
int print(char *o, int maxlen) const;
bool parse(const char *s);
- bool is_split(unsigned old_pg_num, unsigned new_pg_num, set<pg_t> *pchildren) const;
+ bool is_split(unsigned old_pg_num, unsigned new_pg_num, std::set<pg_t> *pchildren) const;
bool is_merge_source(unsigned old_pg_num, unsigned new_pg_num, pg_t *parent) const;
bool is_merge_target(unsigned old_pg_num, unsigned new_pg_num) const {
hobject_t get_hobj_start() const;
hobject_t get_hobj_end(unsigned pg_num) const;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
using ceph::encode;
__u8 v = 1;
encode(v, bl);
encode(m_seed, bl);
encode((int32_t)-1, bl); // was preferred
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
using ceph::decode;
__u8 v;
decode(v, bl);
decode(m_seed, bl);
bl.advance(sizeof(int32_t)); // was preferred
}
- void decode_old(bufferlist::const_iterator& bl) {
+ void decode_old(ceph::buffer::list::const_iterator& bl) {
using ceph::decode;
old_pg_t opg;
decode(opg, bl);
*this = opg;
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_t*>& o);
};
WRITE_CLASS_ENCODER(pg_t)
(l.pool() == r.pool() && (l.ps() >= r.ps()));
}
-ostream& operator<<(ostream& out, const pg_t &pg);
+std::ostream& operator<<(std::ostream& out, const pg_t &pg);
namespace std {
template<> struct hash< pg_t >
}
bool is_split(unsigned old_pg_num, unsigned new_pg_num,
- set<spg_t> *pchildren) const {
- set<pg_t> _children;
- set<pg_t> *children = pchildren ? &_children : NULL;
+ std::set<spg_t> *pchildren) const {
+ std::set<pg_t> _children;
+ std::set<pg_t> *children = pchildren ? &_children : NULL;
bool is_split = pgid.is_split(old_pg_num, new_pg_num, children);
if (pchildren && is_split) {
- for (set<pg_t>::iterator i = _children.begin();
+ for (std::set<pg_t>::iterator i = _children.begin();
i != _children.end();
++i) {
pchildren->insert(spg_t(*i, shard));
return ghobject_t::make_pgmeta(pgid.pool(), pgid.ps(), shard);
}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(pgid, bl);
encode(shard, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(pgid, bl);
decode(shard, bl);
DECODE_FINISH(bl);
}
- ghobject_t make_temp_ghobject(const string& name) const {
+ ghobject_t make_temp_ghobject(const std::string& name) const {
return ghobject_t(
hobject_t(object_t(name), "", CEPH_NOSNAP,
pgid.ps(),
};
} // namespace std
-ostream& operator<<(ostream& out, const spg_t &pg);
+std::ostream& operator<<(std::ostream& out, const spg_t &pg);
// ----------------------
}
const std::string to_str() const {
- return string(_str);
+ return std::string(_str);
}
const char *c_str() const {
return _str;
return false;
}
- 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);
size_t encoded_size() const;
inline bool operator==(const coll_t& rhs) const {
return 0; // whatever.
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<coll_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<coll_t*>& o);
};
WRITE_CLASS_ENCODER(coll_t)
-inline ostream& operator<<(ostream& out, const coll_t& c) {
+inline std::ostream& operator<<(std::ostream& out, const coll_t& c) {
out << c.to_str();
return out;
}
template<> struct hash<coll_t> {
size_t operator()(const coll_t &c) const {
size_t h = 0;
- string str(c.to_str());
+ std::string str(c.to_str());
std::string::const_iterator end(str.end());
for (std::string::const_iterator s = str.begin(); s != end; ++s) {
h += *s;
};
} // namespace std
-inline ostream& operator<<(ostream& out, const ceph_object_layout &ol)
+inline std::ostream& operator<<(std::ostream& out, const ceph_object_layout &ol)
{
out << pg_t(ol.ol_pgid);
int su = ol.ol_stripe_unit;
epoch(ce.epoch),
__pad(0) { }
- explicit eversion_t(bufferlist& bl) : __pad(0) { decode(bl); }
+ explicit eversion_t(ceph::buffer::list& bl) : __pad(0) { decode(bl); }
static const eversion_t& max() {
static const eversion_t max(-1,-1);
return c;
}
- string get_key_name() const;
+ std::string get_key_name() const;
// key must point to the beginning of a block of 32 chars
inline void get_key_name(char* key) const {
ritoa<uint32_t, 10, 10>(epoch, key + 10);
}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
#if defined(CEPH_LITTLE_ENDIAN)
bl.append((char *)this, sizeof(version_t) + sizeof(epoch_t));
#else
encode(epoch, bl);
#endif
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
#if defined(CEPH_LITTLE_ENDIAN)
bl.copy(sizeof(version_t) + sizeof(epoch_t), (char *)this);
#else
decode(epoch, bl);
#endif
}
- void decode(bufferlist& bl) {
+ void decode(ceph::buffer::list& bl) {
auto p = std::cbegin(bl);
decode(p);
}
inline bool operator>=(const eversion_t& l, const eversion_t& r) {
return (l.epoch == r.epoch) ? (l.version >= r.version):(l.epoch >= r.epoch);
}
-inline ostream& operator<<(ostream& out, const eversion_t& e) {
+inline std::ostream& operator<<(std::ostream& out, const eversion_t& e) {
return out << e.epoch << "'" << e.version;
}
os_commit_latency_ns -= o.os_commit_latency_ns;
os_apply_latency_ns -= o.os_apply_latency_ns;
}
- void dump(Formatter *f) const;
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
static void generate_test_instances(std::list<objectstore_perf_stat_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(objectstore_perf_stat_t)
#define PG_STATE_FORCED_BACKFILL (1ULL << 31) // force backfill of this pg before any other
std::string pg_state_string(uint64_t state);
-std::string pg_vector_string(const vector<int32_t> &a);
+std::string pg_vector_string(const std::vector<int32_t> &a);
boost::optional<uint64_t> pg_string_state(const std::string& state);
struct pool_snap_info_t {
snapid_t snapid;
utime_t stamp;
- string name;
+ std::string name;
- void dump(Formatter *f) const;
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& bl);
- static void generate_test_instances(list<pool_snap_info_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ static void generate_test_instances(std::list<pool_snap_info_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(pool_snap_info_t)
-inline ostream& operator<<(ostream& out, const pool_snap_info_t& si) {
+inline std::ostream& operator<<(std::ostream& out, const pool_snap_info_t& si) {
return out << si.snapid << '(' << si.name << ' ' << si.stamp << ')';
}
bool unset(key_t key);
- void dump(const std::string& name, Formatter *f) const;
+ void dump(const std::string& name, ceph::Formatter *f) const;
- void dump(Formatter *f) const;
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
private:
typedef std::map<key_t, value_t> opts_t;
opts_t opts;
- friend ostream& operator<<(ostream& out, const pool_opts_t& opts);
+ friend std::ostream& operator<<(std::ostream& out, const pool_opts_t& opts);
};
WRITE_CLASS_ENCODER_FEATURES(pool_opts_t)
eversion_t source_version;
eversion_t target_version;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(source_pgid, bl);
encode(ready_epoch, bl);
encode(target_version, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& p) {
+ void decode(ceph::buffer::list::const_iterator& p) {
DECODE_START(1, p);
decode(source_pgid, p);
decode(ready_epoch, p);
decode(target_version, p);
DECODE_FINISH(p);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_stream("source_pgid") << source_pgid;
f->dump_unsigned("ready_epoch", ready_epoch);
f->dump_unsigned("last_epoch_started", last_epoch_started);
default: return "???";
}
}
- static string get_flags_string(uint64_t f) {
- string s;
+ static std::string get_flags_string(uint64_t f) {
+ std::string s;
for (unsigned n=0; f && n<64; ++n) {
if (f & (1ull << n)) {
if (s.length())
}
return s;
}
- string get_flags_string() const {
+ std::string get_flags_string() const {
return get_flags_string(flags);
}
- static uint64_t get_flag_by_name(const string& name) {
+ static uint64_t get_flag_by_name(const std::string& name) {
if (name == "hashpspool")
return FLAG_HASHPSPOOL;
if (name == "full")
}
/// converts the acting/up vector to a set of pg shards
- void convert_to_pg_shards(const vector<int> &from, set<pg_shard_t>* to) const;
+ void convert_to_pg_shards(const std::vector<int> &from, std::set<pg_shard_t>* to) const;
typedef enum {
CACHEMODE_NONE = 0, ///< no caching
default: return "unknown";
}
}
- static cache_mode_t get_cache_mode_from_str(const string& s) {
+ static cache_mode_t get_cache_mode_from_str(const std::string& s) {
if (s == "none")
return CACHEMODE_NONE;
if (s == "writeback")
default: return "???";
}
}
- static int get_pg_autoscale_mode_by_name(const string& m) {
+ static int get_pg_autoscale_mode_by_name(const std::string& m) {
if (m == "off") {
return PG_AUTOSCALE_MODE_OFF;
}
__u32 pgp_num_target = 0; ///< pgp_num we should converge toward
public:
- map<string,string> properties; ///< OBSOLETE
- string erasure_code_profile; ///< name of the erasure code profile in OSDMap
+ std::map<std::string, std::string> properties; ///< OBSOLETE
+ std::string erasure_code_profile; ///< name of the erasure code profile in OSDMap
epoch_t last_change; ///< most recent epoch changed, exclusing snapshot changes
/// last epoch that forced clients to resend
* the pool, unless the client manually specifies an alternate
* context.
*/
- map<snapid_t, pool_snap_info_t> snaps;
+ std::map<snapid_t, pool_snap_info_t> snaps;
/*
* Alternatively, if we are defining non-pool snaps (e.g. via the
* Ceph MDS), we must track @removed_snaps (since @snaps is not
unsigned pg_num_mask, pgp_num_mask;
- set<uint64_t> tiers; ///< pools that are tiers of us
+ std::set<uint64_t> tiers; ///< pools that are tiers of us
int64_t tier_of; ///< pool for which we are a tier
// Note that write wins for read+write ops
int64_t read_tier; ///< pool/tier for objecter to direct reads to
TYPE_FINGERPRINT_NONE = 0,
TYPE_FINGERPRINT_SHA1 = 1,
} fingerprint_t;
- static fingerprint_t get_fingerprint_from_str(const string& s) {
+ static fingerprint_t get_fingerprint_from_str(const std::string& s) {
if (s == "none")
return TYPE_FINGERPRINT_NONE;
if (s == "sha1")
return (fingerprint_t)-1;
}
const fingerprint_t get_fingerprint_type() const {
- string fp_str;
+ std::string fp_str;
opts.get(pool_opts_t::FINGERPRINT_ALGORITHM, &fp_str);
return get_fingerprint_from_str(fp_str);
}
const char *get_fingerprint_name() const {
- string fp_str;
+ std::string fp_str;
fingerprint_t fp_t;
opts.get(pool_opts_t::FINGERPRINT_ALGORITHM, &fp_str);
fp_t = get_fingerprint_from_str(fp_str);
}
/// application -> key/value metadata
- map<string, std::map<string, string>> application_metadata;
+ std::map<std::string, std::map<std::string, std::string>> application_metadata;
private:
- vector<uint32_t> grade_table;
+ std::vector<uint32_t> grade_table;
public:
uint32_t get_grade(unsigned i) const {
opts()
{ }
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
const utime_t &get_create_time() const { return create_time; }
uint64_t get_flags() const { return flags; }
SnapContext get_snap_context() const;
/// hash a object name+namespace key to a hash position
- uint32_t hash_key(const string& key, const string& ns) const;
+ uint32_t hash_key(const std::string& key, const std::string& ns) const;
/// round a hash position down to a pg num
uint32_t raw_hash_to_pg(uint32_t v) const;
/// choose a random hash position within a pg
uint32_t get_random_pg_position(pg_t pgid, uint32_t seed) const;
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& bl);
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
- static void generate_test_instances(list<pg_pool_t*>& o);
+ static void generate_test_instances(std::list<pg_pool_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(pg_pool_t)
-ostream& operator<<(ostream& out, const pg_pool_t& p);
+std::ostream& operator<<(std::ostream& out, const pg_pool_t& p);
/**
#undef FLOOR
}
- void split(vector<object_stat_sum_t> &out) const {
+ void split(std::vector<object_stat_sum_t> &out) const {
#define SPLIT(PARAM) \
for (unsigned i = 0; i < out.size(); ++i) { \
out[i].PARAM = PARAM / out.size(); \
void add(const object_stat_sum_t& o);
void sub(const object_stat_sum_t& o);
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
void padding_check() {
static_assert(
sizeof(object_stat_sum_t) ==
,
"object_stat_sum_t have padding");
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- static void generate_test_instances(list<object_stat_sum_t*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ static void generate_test_instances(std::list<object_stat_sum_t*>& o);
};
WRITE_CLASS_ENCODER(object_stat_sum_t)
sum.calc_copies(nrep);
}
- void dump(Formatter *f) const;
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- static void generate_test_instances(list<object_stat_collection_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ static void generate_test_instances(std::list<object_stat_collection_t*>& o);
bool is_zero() const {
return sum.is_zero();
int64_t log_size;
int64_t ondisk_log_size; // >= active_log_size
- vector<int32_t> up, acting;
+ std::vector<int32_t> up, acting;
epoch_t mapping_epoch;
- vector<int32_t> blocked_by; ///< osds on which the pg is blocked
+ std::vector<int32_t> blocked_by; ///< osds on which the pg is blocked
interval_set<snapid_t> purged_snaps; ///< recently removed snaps that we've purged
}
}
- pair<epoch_t, version_t> get_version_pair() const {
- return make_pair(reported_epoch, reported_seq);
+ std::pair<epoch_t, version_t> get_version_pair() const {
+ return { reported_epoch, reported_seq };
}
void floor(int64_t f) {
}
bool is_acting_osd(int32_t osd, bool primary) const;
- void dump(Formatter *f) const;
- void dump_brief(Formatter *f) const;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- static void generate_test_instances(list<pg_stat_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ void dump_brief(ceph::Formatter *f) const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ static void generate_test_instances(std::list<pg_stat_t*>& o);
};
WRITE_CLASS_ENCODER(pg_stat_t)
omap_allocated -= o.omap_allocated;
internal_metadata -= o.internal_metadata;
}
- void dump(Formatter *f) const;
+ void dump(ceph::Formatter *f) const;
DENC(store_statfs_t, v, p) {
DENC_START(1, 1, p);
denc(v.total, p);
denc(v.internal_metadata, p);
DENC_FINISH(p);
}
- static void generate_test_instances(list<store_statfs_t*>& o);
+ static void generate_test_instances(std::list<store_statfs_t*>& o);
};
WRITE_CLASS_DENC(store_statfs_t)
-ostream &operator<<(ostream &lhs, const store_statfs_t &rhs);
+std::ostream &operator<<(std::ostream &lhs, const store_statfs_t &rhs);
/** osd_stat
* aggregate stats for an osd
*/
struct osd_stat_t {
store_statfs_t statfs;
- vector<int> hb_peers;
+ std::vector<int> hb_peers;
int32_t snap_trim_queue_len, num_snap_trimming;
pow2_hist_t op_queue_age_hist;
}
}
}
- void dump(Formatter *f) const;
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
static void generate_test_instances(std::list<osd_stat_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(osd_stat_t)
return !(l == r);
}
-inline ostream& operator<<(ostream& out, const osd_stat_t& s) {
+inline std::ostream& operator<<(std::ostream& out, const osd_stat_t& s) {
return out << "osd_stat(" << s.statfs << ", "
<< "peers " << s.hb_peers
<< " op hist " << s.op_queue_age_hist.h
return user_bytes;
}
- void dump(Formatter *f) const;
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl);
- static void generate_test_instances(list<pool_stat_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ static void generate_test_instances(std::list<pool_stat_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(pool_stat_t)
explicit pg_hit_set_info_t(bool using_gmt = true)
: using_gmt(using_gmt) {}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_hit_set_info_t*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_hit_set_info_t*>& o);
};
WRITE_CLASS_ENCODER(pg_hit_set_info_t)
*/
struct pg_hit_set_history_t {
eversion_t current_last_update; ///< last version inserted into current set
- list<pg_hit_set_info_t> history; ///< archived sets, sorted oldest -> newest
+ std::list<pg_hit_set_info_t> history; ///< archived sets, sorted oldest -> newest
friend bool operator==(const pg_hit_set_history_t& l,
const pg_hit_set_history_t& r) {
l.history == r.history;
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_hit_set_history_t*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_hit_set_history_t*>& o);
};
WRITE_CLASS_ENCODER(pg_hit_set_history_t)
return modified;
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_history_t*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_history_t*>& o);
};
WRITE_CLASS_ENCODER(pg_history_t)
-inline ostream& operator<<(ostream& out, const pg_history_t& h) {
+inline std::ostream& operator<<(std::ostream& out, const pg_history_t& h) {
return out << "ec=" << h.epoch_created << "/" << h.epoch_pool_created
<< " lis/c " << h.last_interval_started
<< "/" << h.last_interval_clean
bool has_missing() const { return last_complete != last_update; }
bool is_incomplete() const { return !last_backfill.is_max(); }
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& p);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_info_t*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& p);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_info_t*>& o);
};
WRITE_CLASS_ENCODER(pg_info_t)
-inline ostream& operator<<(ostream& out, const pg_info_t& pgi)
+inline std::ostream& operator<<(std::ostream& out, const pg_info_t& pgi)
{
out << pgi.pgid << "(";
if (pgi.dne())
return true;
}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(last_update, bl);
encode(last_complete, bl);
encode(stats.stats.sum.num_objects_dirty, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& p) {
+ void decode(ceph::buffer::list::const_iterator& p) {
DECODE_START(1, p);
decode(last_update, p);
decode(last_complete, p);
info(info), to(to), from(from) {
ceph_assert(from == info.pgid.shard);
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &p);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_notify_t*> &o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &p);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_notify_t*> &o);
};
WRITE_CLASS_ENCODER(pg_notify_t)
-ostream &operator<<(ostream &lhs, const pg_notify_t ¬ify);
+std::ostream &operator<<(std::ostream &lhs, const pg_notify_t ¬ify);
class OSDMap;
class PastIntervals {
public:
struct pg_interval_t {
- vector<int32_t> up, acting;
+ std::vector<int32_t> up, acting;
epoch_t first, last;
bool maybe_went_rw;
int32_t primary;
{}
pg_interval_t(
- vector<int32_t> &&up,
- vector<int32_t> &&acting,
+ std::vector<int32_t> &&up,
+ std::vector<int32_t> &&acting,
epoch_t first,
epoch_t last,
bool maybe_went_rw,
maybe_went_rw(maybe_went_rw), primary(primary), up_primary(up_primary)
{}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_interval_t*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_interval_t*>& o);
};
PastIntervals();
virtual size_t size() const = 0;
virtual bool empty() const = 0;
virtual void clear() = 0;
- virtual pair<epoch_t, epoch_t> get_bounds() const = 0;
- virtual set<pg_shard_t> get_all_participants(
+ virtual std::pair<epoch_t, epoch_t> get_bounds() const = 0;
+ virtual std::set<pg_shard_t> get_all_participants(
bool ec_pool) const = 0;
virtual void add_interval(bool ec_pool, const pg_interval_t &interval) = 0;
- virtual unique_ptr<interval_rep> clone() const = 0;
- virtual ostream &print(ostream &out) const = 0;
- virtual void encode(bufferlist &bl) const = 0;
- virtual void decode(bufferlist::const_iterator &bl) = 0;
- virtual void dump(Formatter *f) const = 0;
+ virtual std::unique_ptr<interval_rep> clone() const = 0;
+ virtual std::ostream &print(std::ostream &out) const = 0;
+ virtual void encode(ceph::buffer::list &bl) const = 0;
+ virtual void decode(ceph::buffer::list::const_iterator &bl) = 0;
+ virtual void dump(ceph::Formatter *f) const = 0;
virtual void iterate_mayberw_back_to(
epoch_t les,
- std::function<void(epoch_t, const set<pg_shard_t> &)> &&f) const = 0;
+ std::function<void(epoch_t, const std::set<pg_shard_t> &)> &&f) const = 0;
virtual bool has_full_intervals() const { return false; }
virtual void iterate_all_intervals(
friend class pi_compact_rep;
private:
- unique_ptr<interval_rep> past_intervals;
+ std::unique_ptr<interval_rep> past_intervals;
explicit PastIntervals(interval_rep *rep) : past_intervals(rep) {}
return past_intervals->add_interval(ec_pool, interval);
}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
if (past_intervals) {
__u8 type = 2;
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl);
+ void decode(ceph::buffer::list::const_iterator &bl);
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
ceph_assert(past_intervals);
past_intervals->dump(f);
}
- static void generate_test_instances(list<PastIntervals *> & o);
+ static void generate_test_instances(std::list<PastIntervals *> & o);
/**
* Determines whether there is an interval change
static bool is_new_interval(
int old_acting_primary,
int new_acting_primary,
- const vector<int> &old_acting,
- const vector<int> &new_acting,
+ const std::vector<int> &old_acting,
+ const std::vector<int> &new_acting,
int old_up_primary,
int new_up_primary,
- const vector<int> &old_up,
- const vector<int> &new_up,
+ const std::vector<int> &old_up,
+ const std::vector<int> &new_up,
int old_size,
int new_size,
int old_min_size,
static bool is_new_interval(
int old_acting_primary, ///< [in] primary as of lastmap
int new_acting_primary, ///< [in] primary as of lastmap
- const vector<int> &old_acting, ///< [in] acting as of lastmap
- const vector<int> &new_acting, ///< [in] acting as of osdmap
+ const std::vector<int> &old_acting, ///< [in] acting as of lastmap
+ const std::vector<int> &new_acting, ///< [in] acting as of osdmap
int old_up_primary, ///< [in] up primary of lastmap
int new_up_primary, ///< [in] up primary of osdmap
- const vector<int> &old_up, ///< [in] up as of lastmap
- const vector<int> &new_up, ///< [in] up as of osdmap
+ const std::vector<int> &old_up, ///< [in] up as of lastmap
+ const std::vector<int> &new_up, ///< [in] up as of osdmap
std::shared_ptr<const OSDMap> osdmap, ///< [in] current map
std::shared_ptr<const OSDMap> lastmap, ///< [in] last map
pg_t pgid ///< [in] pgid for pg
static bool check_new_interval(
int old_acting_primary, ///< [in] primary as of lastmap
int new_acting_primary, ///< [in] primary as of osdmap
- const vector<int> &old_acting, ///< [in] acting as of lastmap
- const vector<int> &new_acting, ///< [in] acting as of osdmap
+ const std::vector<int> &old_acting, ///< [in] acting as of lastmap
+ const std::vector<int> &new_acting, ///< [in] acting as of osdmap
int old_up_primary, ///< [in] up primary of lastmap
int new_up_primary, ///< [in] up primary of osdmap
- const vector<int> &old_up, ///< [in] up as of lastmap
- const vector<int> &new_up, ///< [in] up as of osdmap
+ const std::vector<int> &old_up, ///< [in] up as of lastmap
+ const std::vector<int> &new_up, ///< [in] up as of osdmap
epoch_t same_interval_since, ///< [in] as of osdmap
epoch_t last_epoch_clean, ///< [in] current
std::shared_ptr<const OSDMap> osdmap, ///< [in] current map
pg_t pgid, ///< [in] pgid for pg
IsPGRecoverablePredicate *could_have_gone_active, ///< [in] predicate whether the pg can be active
PastIntervals *past_intervals, ///< [out] intervals
- ostream *out = 0 ///< [out] debug ostream
+ std::ostream *out = 0 ///< [out] debug ostream
);
- friend ostream& operator<<(ostream& out, const PastIntervals &i);
+ friend std::ostream& operator<<(std::ostream& out, const PastIntervals &i);
template <typename F>
void iterate_mayberw_back_to(
* Return all shards which have been in the acting set back to the
* latest epoch to which we have trimmed except for pg_whoami
*/
- set<pg_shard_t> get_might_have_unfound(
+ std::set<pg_shard_t> get_might_have_unfound(
pg_shard_t pg_whoami,
bool ec_pool) const {
ceph_assert(past_intervals);
/**
* Return all shards which we might want to talk to for peering
*/
- set<pg_shard_t> get_all_probe(
+ std::set<pg_shard_t> get_all_probe(
bool ec_pool) const {
ceph_assert(past_intervals);
return past_intervals->get_all_participants(ec_pool);
/* Return the set of epochs [start, end) represented by the
* past_interval set.
*/
- pair<epoch_t, epoch_t> get_bounds() const {
+ std::pair<epoch_t, epoch_t> get_bounds() const {
ceph_assert(past_intervals);
return past_intervals->get_bounds();
}
};
struct PriorSet {
bool ec_pool = false;
- set<pg_shard_t> probe; ///< current+prior OSDs we need to probe.
- set<int> down; ///< down osds that would normally be in @a probe and might be interesting.
- map<int, epoch_t> blocked_by; ///< current lost_at values for any OSDs in cur set for which (re)marking them lost would affect cur set
+ std::set<pg_shard_t> probe; ///< current+prior OSDs we need to probe.
+ std::set<int> down; ///< down osds that would normally be in @a probe and might be interesting.
+ std::map<int, epoch_t> blocked_by; ///< current lost_at values for any OSDs in cur set for which (re)marking them lost would affect cur set
bool pg_down = false; ///< some down osds are included in @a cur; the DOWN pg state bit should be set.
- unique_ptr<IsPGRecoverablePredicate> pcontdec;
+ std::unique_ptr<IsPGRecoverablePredicate> pcontdec;
PriorSet() = default;
PriorSet(PriorSet &&) = default;
// For verifying tests
PriorSet(
bool ec_pool,
- set<pg_shard_t> probe,
- set<int> down,
- map<int, epoch_t> blocked_by,
+ std::set<pg_shard_t> probe,
+ std::set<int> down,
+ std::map<int, epoch_t> blocked_by,
bool pg_down,
IsPGRecoverablePredicate *pcontdec)
: ec_pool(ec_pool), probe(probe), down(down), blocked_by(blocked_by),
epoch_t last_epoch_started,
IsPGRecoverablePredicate *c,
F f,
- const vector<int> &up,
- const vector<int> &acting,
+ const std::vector<int> &up,
+ const std::vector<int> &acting,
const DoutPrefixProvider *dpp);
friend class PastIntervals;
};
WRITE_CLASS_ENCODER(PastIntervals)
-ostream& operator<<(ostream& out, const PastIntervals::pg_interval_t& i);
-ostream& operator<<(ostream& out, const PastIntervals &i);
-ostream& operator<<(ostream& out, const PastIntervals::PriorSet &i);
+std::ostream& operator<<(std::ostream& out, const PastIntervals::pg_interval_t& i);
+std::ostream& operator<<(std::ostream& out, const PastIntervals &i);
+std::ostream& operator<<(std::ostream& out, const PastIntervals::PriorSet &i);
template <typename F>
PastIntervals::PriorSet::PriorSet(
epoch_t last_epoch_started,
IsPGRecoverablePredicate *c,
F f,
- const vector<int> &up,
- const vector<int> &acting,
+ const std::vector<int> &up,
+ const std::vector<int> &acting,
const DoutPrefixProvider *dpp)
: ec_pool(ec_pool), pg_down(false), pcontdec(c)
{
probe.insert(pg_shard_t(up[i], ec_pool ? shard_id_t(i) : shard_id_t::NO_SHARD));
}
- set<pg_shard_t> all_probe = past_intervals.get_all_probe(ec_pool);
+ std::set<pg_shard_t> all_probe = past_intervals.get_all_probe(ec_pool);
ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl;
for (auto &&i: all_probe) {
switch (f(0, i.osd, nullptr)) {
past_intervals.iterate_mayberw_back_to(
last_epoch_started,
- [&](epoch_t start, const set<pg_shard_t> &acting) {
+ [&](epoch_t start, const std::set<pg_shard_t> &acting) {
ldpp_dout(dpp, 10) << "build_prior maybe_rw interval:" << start
<< ", acting: " << acting << dendl;
// look at candidate osds during this interval. each falls into
// one of three categories: up, down (but potentially
// interesting), or lost (down, but we won't wait for it).
- set<pg_shard_t> up_now;
- map<int, epoch_t> candidate_blocked_by;
+ std::set<pg_shard_t> up_now;
+ std::map<int, epoch_t> candidate_blocked_by;
// any candidates down now (that might have useful data)
bool any_down_now = false;
ceph_assert(t == LOG);
}
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl);
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_query_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_query_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(pg_query_t)
-inline ostream& operator<<(ostream& out, const pg_query_t& q) {
+inline std::ostream& operator<<(std::ostream& out, const pg_query_t& q) {
out << "query(" << q.get_type_name() << " " << q.since;
if (q.type == pg_query_t::LOG)
out << " " << q.history;
class Visitor {
public:
virtual void append(uint64_t old_offset) {}
- virtual void setattrs(map<string, boost::optional<bufferlist> > &attrs) {}
+ virtual void setattrs(std::map<std::string, boost::optional<ceph::buffer::list>> &attrs) {}
virtual void rmobject(version_t old_version) {}
/**
* Used to support the unfound_lost_delete log event: if the stashed
rmobject(old_version);
}
virtual void create() {}
- virtual void update_snaps(const set<snapid_t> &old_snaps) {}
+ virtual void update_snaps(const std::set<snapid_t> &old_snaps) {}
virtual void rollback_extents(
version_t gen,
- const vector<pair<uint64_t, uint64_t> > &extents) {}
+ const std::vector<std::pair<uint64_t, uint64_t> > &extents) {}
virtual ~Visitor() {}
};
void visit(Visitor *visitor) const;
- mutable bufferlist bl;
+ mutable ceph::buffer::list bl;
enum ModID {
APPEND = 1,
SETATTRS = 2,
encode(old_size, bl);
ENCODE_FINISH(bl);
}
- void setattrs(map<string, boost::optional<bufferlist> > &old_attrs) {
+ void setattrs(std::map<std::string, boost::optional<ceph::buffer::list>> &old_attrs) {
if (!can_local_rollback || rollback_info_completed)
return;
ENCODE_START(1, 1, bl);
append_id(CREATE);
ENCODE_FINISH(bl);
}
- void update_snaps(const set<snapid_t> &old_snaps) {
+ void update_snaps(const std::set<snapid_t> &old_snaps) {
if (!can_local_rollback || rollback_info_completed)
return;
ENCODE_START(1, 1, bl);
ENCODE_FINISH(bl);
}
void rollback_extents(
- version_t gen, const vector<pair<uint64_t, uint64_t> > &extents) {
+ version_t gen, const std::vector<std::pair<uint64_t, uint64_t> > &extents) {
ceph_assert(can_local_rollback);
ceph_assert(!rollback_info_completed);
if (max_required_version < 2)
if (bl.length() > 0)
bl.rebuild();
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<ObjectModDesc*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<ObjectModDesc*>& o);
};
WRITE_CLASS_ENCODER(ObjectModDesc)
// describes state for a locally-rollbackable entry
ObjectModDesc mod_desc;
- bufferlist snaps; // only for clone entries
+ ceph::buffer::list snaps; // only for clone entries
hobject_t soid;
osd_reqid_t reqid; // caller+tid to uniquely identify request
- mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > extra_reqids;
+ mempool::osd_pglog::vector<std::pair<osd_reqid_t, version_t> > extra_reqids;
/// map extra_reqids by index to error return code (if any)
mempool::osd_pglog::map<uint32_t, int> extra_reqid_return_codes;
(op == MODIFY || op == DELETE || op == ERROR);
}
- string get_key_name() const;
- void encode_with_checksum(bufferlist& bl) const;
- void decode_with_checksum(bufferlist::const_iterator& p);
+ std::string get_key_name() const;
+ void encode_with_checksum(ceph::buffer::list& bl) const;
+ void decode_with_checksum(ceph::buffer::list::const_iterator& p);
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_log_entry_t*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_log_entry_t*>& o);
};
WRITE_CLASS_ENCODER(pg_log_entry_t)
-ostream& operator<<(ostream& out, const pg_log_entry_t& e);
+std::ostream& operator<<(std::ostream& out, const pg_log_entry_t& e);
struct pg_log_dup_t {
osd_reqid_t reqid; // caller+tid to uniquely identify request
return_code(return_code)
{}
- string get_key_name() const;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_log_dup_t*>& o);
+ std::string get_key_name() const;
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_log_dup_t*>& o);
bool operator==(const pg_log_dup_t &rhs) const {
return reqid == rhs.reqid &&
return divergent;
}
- void merge_from(const vector<pg_log_t*>& slogs, eversion_t last_update) {
+ void merge_from(const std::vector<pg_log_t*>& slogs, eversion_t last_update) {
log.clear();
// sort and merge dups
- multimap<eversion_t,pg_log_dup_t> sorted;
+ std::multimap<eversion_t,pg_log_dup_t> sorted;
for (auto& d : dups) {
sorted.emplace(d.version, d);
}
}
static void filter_log(spg_t import_pgid, const OSDMap &curmap,
- const string &hit_set_namespace, const pg_log_t &in,
+ const std::string &hit_set_namespace, const pg_log_t &in,
pg_log_t &out, pg_log_t &reject);
/**
*/
void copy_up_to(const pg_log_t &other, int max);
- ostream& print(ostream& out) const;
+ std::ostream& print(std::ostream& out) const;
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl, int64_t pool = -1);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_log_t*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl, int64_t pool = -1);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_log_t*>& o);
};
WRITE_CLASS_ENCODER(pg_log_t)
-inline ostream& operator<<(ostream& out, const pg_log_t& log)
+inline std::ostream& operator<<(std::ostream& out, const pg_log_t& log)
{
out << "log((" << log.tail << "," << log.head << "], crt="
<< log.get_can_rollback_to() << ")";
set_delete(is_delete);
}
- void encode(bufferlist& bl, uint64_t features) const {
+ void encode(ceph::buffer::list& bl, uint64_t features) const {
using ceph::encode;
if (HAVE_FEATURE(features, OSD_RECOVERY_DELETES)) {
// encoding a zeroed eversion_t to differentiate between this and
encode(have, bl);
}
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
using ceph::decode;
eversion_t e;
decode(e, bl);
return (flags & FLAG_DELETE) == FLAG_DELETE;
}
- string flag_str() const {
+ std::string flag_str() const {
if (flags == FLAG_NONE) {
return "none";
} else {
}
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_stream("need") << need;
f->dump_stream("have") << have;
f->dump_stream("flags") << flag_str();
}
- static void generate_test_instances(list<pg_missing_item*>& o) {
+ static void generate_test_instances(std::list<pg_missing_item*>& o) {
o.push_back(new pg_missing_item);
o.push_back(new pg_missing_item);
o.back()->need = eversion_t(1, 2);
}
};
WRITE_CLASS_ENCODER_FEATURES(pg_missing_item)
-ostream& operator<<(ostream& out, const pg_missing_item &item);
+std::ostream& operator<<(std::ostream& out, const pg_missing_item &item);
class pg_missing_const_i {
public:
- virtual const map<hobject_t, pg_missing_item> &
+ virtual const std::map<hobject_t, pg_missing_item> &
get_items() const = 0;
- virtual const map<version_t, hobject_t> &get_rmissing() const = 0;
+ virtual const std::map<version_t, hobject_t> &get_rmissing() const = 0;
virtual bool get_may_include_deletes() const = 0;
virtual unsigned int num_missing() const = 0;
virtual bool have_missing() const = 0;
};
template <>
class ChangeTracker<true> {
- set<hobject_t> _changed;
+ std::set<hobject_t> _changed;
public:
void changed(const hobject_t &obj) {
_changed.insert(obj);
template <bool TrackChanges>
class pg_missing_set : public pg_missing_const_i {
using item = pg_missing_item;
- map<hobject_t, item> missing; // oid -> (need v, have v)
- map<version_t, hobject_t> rmissing; // v -> oid
+ std::map<hobject_t, item> missing; // oid -> (need v, have v)
+ std::map<version_t, hobject_t> rmissing; // v -> oid
ChangeTracker<TrackChanges> tracker;
public:
bool may_include_deletes = false;
- const map<hobject_t, item> &get_items() const override {
+ const std::map<hobject_t, item> &get_items() const override {
return missing;
}
- const map<version_t, hobject_t> &get_rmissing() const override {
+ const std::map<version_t, hobject_t> &get_rmissing() const override {
return rmissing;
}
bool get_may_include_deletes() const override {
return true;
}
bool is_missing(const hobject_t& oid, eversion_t v) const override {
- map<hobject_t, item>::const_iterator m =
+ std::map<hobject_t, item>::const_iterator m =
missing.find(oid);
if (m == missing.end())
return false;
* assumes missing is accurate up through the previous log entry.
*/
void add_next_event(const pg_log_entry_t& e) {
- map<hobject_t, item>::iterator missing_it;
+ std::map<hobject_t, item>::iterator missing_it;
missing_it = missing.find(e.soid);
bool is_missing_divergent_item = missing_it != missing.end();
if (e.prior_version == eversion_t() || e.is_clone()) {
pg_missing_set *omissing) {
omissing->may_include_deletes = may_include_deletes;
unsigned mask = ~((~0)<<split_bits);
- for (map<hobject_t, item>::iterator i = missing.begin();
+ for (std::map<hobject_t, item>::iterator i = missing.begin();
i != missing.end();
) {
if ((i->first.get_hash() & mask) == child_pgid.m_seed) {
rmissing.clear();
}
- void encode(bufferlist &bl) const {
+ void encode(ceph::buffer::list &bl) const {
ENCODE_START(4, 2, bl);
encode(missing, bl, may_include_deletes ? CEPH_FEATURE_OSD_RECOVERY_DELETES : 0);
encode(may_include_deletes, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl, int64_t pool = -1) {
+ void decode(ceph::buffer::list::const_iterator &bl, int64_t pool = -1) {
for (auto const &i: missing)
tracker.changed(i.first);
DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
if (struct_v < 3) {
// Handle hobject_t upgrade
- map<hobject_t, item> tmp;
- for (map<hobject_t, item>::iterator i =
+ std::map<hobject_t, item> tmp;
+ for (std::map<hobject_t, item>::iterator i =
missing.begin();
i != missing.end();
) {
missing.insert(tmp.begin(), tmp.end());
}
- for (map<hobject_t,item>::iterator it =
+ for (std::map<hobject_t,item>::iterator it =
missing.begin();
it != missing.end();
++it)
for (auto const &i: missing)
tracker.changed(i.first);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->open_array_section("missing");
- for (map<hobject_t,item>::const_iterator p =
+ for (std::map<hobject_t,item>::const_iterator p =
missing.begin(); p != missing.end(); ++p) {
f->open_object_section("item");
f->dump_stream("object") << p->first;
}
}
}
- static void generate_test_instances(list<pg_missing_set*>& o) {
+ static void generate_test_instances(std::list<pg_missing_set*>& o) {
o.push_back(new pg_missing_set);
o.push_back(new pg_missing_set);
o.back()->add(
template <typename missing_t>
bool debug_verify_from_init(
const missing_t &init_missing,
- ostream *oss) const {
+ std::ostream *oss) const {
if (!TrackChanges)
return true;
auto check_missing(init_missing.get_items());
}
if (oss && !ok) {
*oss << "check_missing: " << check_missing << "\n";
- set<hobject_t> changed;
+ std::set<hobject_t> changed;
tracker.get_changed([&](const hobject_t &hoid) { changed.insert(hoid); });
*oss << "changed: " << changed << "\n";
}
};
template <bool TrackChanges>
void encode(
- const pg_missing_set<TrackChanges> &c, bufferlist &bl, uint64_t features=0) {
+ const pg_missing_set<TrackChanges> &c, ceph::buffer::list &bl, uint64_t features=0) {
ENCODE_DUMP_PRE();
c.encode(bl);
ENCODE_DUMP_POST(cl);
}
template <bool TrackChanges>
-void decode(pg_missing_set<TrackChanges> &c, bufferlist::const_iterator &p) {
+void decode(pg_missing_set<TrackChanges> &c, ceph::buffer::list::const_iterator &p) {
c.decode(p);
}
template <bool TrackChanges>
-ostream& operator<<(ostream& out, const pg_missing_set<TrackChanges> &missing)
+std::ostream& operator<<(std::ostream& out, const pg_missing_set<TrackChanges> &missing)
{
out << "missing(" << missing.num_missing()
<< " may_include_deletes = " << missing.may_include_deletes;
*/
struct pg_nls_response_t {
collection_list_handle_t handle;
- list<librados::ListObjectImpl> entries;
+ std::list<librados::ListObjectImpl> entries;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(handle, bl);
__u32 n = (__u32)entries.size();
encode(n, bl);
- for (list<librados::ListObjectImpl>::const_iterator i = entries.begin(); i != entries.end(); ++i) {
+ for (std::list<librados::ListObjectImpl>::const_iterator i = entries.begin(); i != entries.end(); ++i) {
encode(i->nspace, bl);
encode(i->oid, bl);
encode(i->locator, bl);
}
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(handle, bl);
__u32 n;
}
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_stream("handle") << handle;
f->open_array_section("entries");
- for (list<librados::ListObjectImpl>::const_iterator p = entries.begin(); p != entries.end(); ++p) {
+ for (std::list<librados::ListObjectImpl>::const_iterator p = entries.begin(); p != entries.end(); ++p) {
f->open_object_section("object");
f->dump_string("namespace", p->nspace);
f->dump_string("object", p->oid);
}
f->close_section();
}
- static void generate_test_instances(list<pg_nls_response_t*>& o) {
+ static void generate_test_instances(std::list<pg_nls_response_t*>& o) {
o.push_back(new pg_nls_response_t);
o.push_back(new pg_nls_response_t);
o.back()->handle = hobject_t(object_t("hi"), "key", 1, 2, -1, "");
// For backwards compatibility with older OSD requests
struct pg_ls_response_t {
collection_list_handle_t handle;
- list<pair<object_t, string> > entries;
+ std::list<std::pair<object_t, std::string> > entries;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
using ceph::encode;
__u8 v = 1;
encode(v, bl);
encode(handle, bl);
encode(entries, bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
using ceph::decode;
__u8 v;
decode(v, bl);
decode(handle, bl);
decode(entries, bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_stream("handle") << handle;
f->open_array_section("entries");
- for (list<pair<object_t, string> >::const_iterator p = entries.begin(); p != entries.end(); ++p) {
+ for (std::list<std::pair<object_t, std::string> >::const_iterator p = entries.begin(); p != entries.end(); ++p) {
f->open_object_section("object");
f->dump_stream("object") << p->first;
f->dump_string("key", p->second);
}
f->close_section();
}
- static void generate_test_instances(list<pg_ls_response_t*>& o) {
+ static void generate_test_instances(std::list<pg_ls_response_t*>& o) {
o.push_back(new pg_ls_response_t);
o.push_back(new pg_ls_response_t);
o.back()->handle = hobject_t(object_t("hi"), "key", 1, 2, -1, "");
- o.back()->entries.push_back(make_pair(object_t("one"), string()));
- o.back()->entries.push_back(make_pair(object_t("two"), string("twokey")));
+ o.back()->entries.push_back(std::make_pair(object_t("one"), std::string()));
+ o.back()->entries.push_back(std::make_pair(object_t("two"), std::string("twokey")));
}
};
*/
struct object_copy_cursor_t {
uint64_t data_offset;
- string omap_offset;
+ std::string omap_offset;
bool attr_complete;
bool data_complete;
bool omap_complete;
return attr_complete && data_complete && omap_complete;
}
- static void generate_test_instances(list<object_copy_cursor_t*>& o);
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<object_copy_cursor_t*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(object_copy_cursor_t)
utime_t mtime;
uint32_t data_digest, omap_digest;
uint32_t flags;
- map<string, bufferlist> attrs;
- bufferlist data;
- bufferlist omap_header;
- bufferlist omap_data;
+ std::map<std::string, ceph::buffer::list> attrs;
+ ceph::buffer::list data;
+ ceph::buffer::list omap_header;
+ ceph::buffer::list omap_data;
/// which snaps we are defined for (if a snap and not the head)
- vector<snapid_t> snaps;
+ std::vector<snapid_t> snaps;
/// latest snap seq for the object (if head)
snapid_t snap_seq;
/// recent reqids on this object
- mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > reqids;
+ mempool::osd_pglog::vector<std::pair<osd_reqid_t, version_t> > reqids;
/// map reqids by index to error return code (if any)
mempool::osd_pglog::map<uint32_t, int> reqid_return_codes;
truncate_seq(0),
truncate_size(0) {}
- static void generate_test_instances(list<object_copy_data_t*>& o);
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<object_copy_data_t*>& o);
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER_FEATURES(object_copy_data_t)
pg_create_t(unsigned c, pg_t p, int s)
: created(c), parent(p), split_bits(s) {}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<pg_create_t*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<pg_create_t*>& o);
};
WRITE_CLASS_ENCODER(pg_create_t)
object_locator_t oloc; // object locator (pool etc)
- vector<pair<uint64_t,uint64_t> > buffer_extents; // off -> len. extents in buffer being mapped (may be fragmented bc of striping!)
+ std::vector<std::pair<uint64_t,uint64_t> > buffer_extents; // off -> len. extents in buffer being mapped (may be fragmented bc of striping!)
ObjectExtent() : objectno(0), offset(0), length(0), truncate_size(0) {}
ObjectExtent(object_t o, uint64_t ono, uint64_t off, uint64_t l, uint64_t ts) :
oid(o), objectno(ono), offset(off), length(l), truncate_size(ts) { }
};
-inline ostream& operator<<(ostream& out, const ObjectExtent &ex)
+inline std::ostream& operator<<(std::ostream& out, const ObjectExtent &ex)
{
return out << "extent("
<< ex.oid << " (" << ex.objectno << ") in " << ex.oloc
mounted(0), clean_thru(0) {
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<OSDSuperblock*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<OSDSuperblock*>& o);
};
WRITE_CLASS_ENCODER(OSDSuperblock)
-inline ostream& operator<<(ostream& out, const OSDSuperblock& sb)
+inline std::ostream& operator<<(std::ostream& out, const OSDSuperblock& sb)
{
return out << "sb(" << sb.cluster_fsid
<< " osd." << sb.whoami
*/
struct SnapSet {
snapid_t seq;
- vector<snapid_t> snaps; // descending
- vector<snapid_t> clones; // ascending
- map<snapid_t, interval_set<uint64_t> > clone_overlap; // overlap w/ next newest
- map<snapid_t, uint64_t> clone_size;
- map<snapid_t, vector<snapid_t>> clone_snaps; // descending
+ std::vector<snapid_t> snaps; // descending
+ std::vector<snapid_t> clones; // ascending
+ std::map<snapid_t, interval_set<uint64_t> > clone_overlap; // overlap w/ next newest
+ std::map<snapid_t, uint64_t> clone_size;
+ std::map<snapid_t, std::vector<snapid_t>> clone_snaps; // descending
SnapSet() : seq(0) {}
- explicit SnapSet(bufferlist& bl) {
+ explicit SnapSet(ceph::buffer::list& bl) {
auto p = std::cbegin(bl);
decode(p);
}
/// get space accounted to clone
uint64_t get_clone_bytes(snapid_t clone) const;
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<SnapSet*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<SnapSet*>& o);
SnapContext get_ssc_as_of(snapid_t as_of) const {
SnapContext out;
out.seq = as_of;
- for (vector<snapid_t>::const_iterator i = snaps.begin();
+ for (std::vector<snapid_t>::const_iterator i = snaps.begin();
i != snaps.end();
++i) {
if (*i <= as_of)
};
WRITE_CLASS_ENCODER(SnapSet)
-ostream& operator<<(ostream& out, const SnapSet& cs);
+std::ostream& operator<<(std::ostream& out, const SnapSet& cs);
watch_info_t() : cookie(0), timeout_seconds(0) { }
watch_info_t(uint64_t c, uint32_t t, const entity_addr_t& a) : cookie(c), timeout_seconds(t), addr(a) {}
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<watch_info_t*>& o);
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<watch_info_t*>& o);
};
WRITE_CLASS_ENCODER_FEATURES(watch_info_t)
&& l.addr == r.addr;
}
-static inline ostream& operator<<(ostream& out, const watch_info_t& w) {
+static inline std::ostream& operator<<(std::ostream& out, const watch_info_t& w) {
return out << "watch(cookie " << w.cookie << " " << w.timeout_seconds << "s"
<< " " << w.addr << ")";
}
uint64_t cookie;
uint64_t notify_id;
uint32_t timeout;
- bufferlist bl;
+ ceph::buffer::list bl;
};
-static inline ostream& operator<<(ostream& out, const notify_info_t& n) {
+static inline std::ostream& operator<<(std::ostream& out, const notify_info_t& n) {
return out << "notify(cookie " << n.cookie
<< " notify" << n.notify_id
<< " " << n.timeout << "s)";
chunk_info_t() : offset(0), length(0), flags((cflag_t)0) { }
- static string get_flag_string(uint64_t flags) {
- string r;
+ static std::string get_flag_string(uint64_t flags) {
+ std::string r;
if (flags & FLAG_DIRTY) {
r += "|dirty";
}
bool has_fingerprint() const {
return test_flag(FLAG_HAS_FINGERPRINT);
}
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- friend ostream& operator<<(ostream& out, const chunk_info_t& ci);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ friend std::ostream& operator<<(std::ostream& out, const chunk_info_t& ci);
};
WRITE_CLASS_ENCODER(chunk_info_t)
-ostream& operator<<(ostream& out, const chunk_info_t& ci);
+std::ostream& operator<<(std::ostream& out, const chunk_info_t& ci);
struct object_info_t;
struct object_manifest_t {
};
uint8_t type; // redirect, chunked, ...
hobject_t redirect_target;
- map <uint64_t, chunk_info_t> chunk_map;
+ std::map<uint64_t, chunk_info_t> chunk_map;
object_manifest_t() : type(0) { }
object_manifest_t(uint8_t type, const hobject_t& redirect_target)
redirect_target = hobject_t();
chunk_map.clear();
}
- static void generate_test_instances(list<object_manifest_t*>& o);
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- void dump(Formatter *f) const;
- friend ostream& operator<<(ostream& out, const object_info_t& oi);
+ static void generate_test_instances(std::list<object_manifest_t*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ void dump(ceph::Formatter *f) const;
+ friend std::ostream& operator<<(std::ostream& out, const object_info_t& oi);
};
WRITE_CLASS_ENCODER(object_manifest_t)
-ostream& operator<<(ostream& out, const object_manifest_t& oi);
+std::ostream& operator<<(std::ostream& out, const object_manifest_t& oi);
struct object_info_t {
hobject_t soid;
flag_t flags;
- static string get_flag_string(flag_t flags) {
- string s;
- vector<string> sv = get_flag_vector(flags);
+ static std::string get_flag_string(flag_t flags) {
+ std::string s;
+ std::vector<std::string> sv = get_flag_vector(flags);
for (auto ss : sv) {
- s += string("|") + ss;
+ s += std::string("|") + ss;
}
if (s.length())
return s.substr(1);
return s;
}
- static vector<string> get_flag_vector(flag_t flags) {
- vector<string> sv;
+ static std::vector<std::string> get_flag_vector(flag_t flags) {
+ std::vector<std::string> sv;
if (flags & FLAG_LOST)
sv.insert(sv.end(), "lost");
if (flags & FLAG_WHITEOUT)
sv.insert(sv.end(), "redirect_has_reference");
return sv;
}
- string get_flag_string() const {
+ std::string get_flag_string() const {
return get_flag_string(flags);
}
uint64_t truncate_seq, truncate_size;
- map<pair<uint64_t, entity_name_t>, watch_info_t> watchers;
+ std::map<std::pair<uint64_t, entity_name_t>, watch_info_t> watchers;
// opportunistic checksums; may or may not be present
__u32 data_digest; ///< data crc32c
clear_omap_digest();
}
- void encode(bufferlist& bl, uint64_t features) const;
- void decode(bufferlist::const_iterator& bl);
- void decode(bufferlist& bl) {
+ void encode(ceph::buffer::list& bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void decode(ceph::buffer::list& bl) {
auto p = std::cbegin(bl);
decode(p);
}
- void dump(Formatter *f) const;
- static void generate_test_instances(list<object_info_t*>& o);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<object_info_t*>& o);
explicit object_info_t()
: user_version(0), size(0), flags((flag_t)0),
alloc_hint_flags(0)
{}
- explicit object_info_t(bufferlist& bl) {
+ explicit object_info_t(ceph::buffer::list& bl) {
decode(bl);
}
};
WRITE_CLASS_ENCODER_FEATURES(object_info_t)
-ostream& operator<<(ostream& out, const object_info_t& oi);
+std::ostream& operator<<(std::ostream& out, const object_info_t& oi);
object_info_t oi;
SnapSet ss; // only populated if soid is_snap()
interval_set<uint64_t> copy_subset;
- map<hobject_t, interval_set<uint64_t>> clone_subset;
+ std::map<hobject_t, interval_set<uint64_t>> clone_subset;
ObjectRecoveryInfo() : size(0) { }
- static void generate_test_instances(list<ObjectRecoveryInfo*>& o);
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl, int64_t pool = -1);
- ostream &print(ostream &out) const;
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<ObjectRecoveryInfo*>& o);
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl, int64_t pool = -1);
+ std::ostream &print(std::ostream &out) const;
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER_FEATURES(ObjectRecoveryInfo)
-ostream& operator<<(ostream& out, const ObjectRecoveryInfo &inf);
+std::ostream& operator<<(std::ostream& out, const ObjectRecoveryInfo &inf);
struct ObjectRecoveryProgress {
uint64_t data_recovered_to;
- string omap_recovered_to;
+ std::string omap_recovered_to;
bool first;
bool data_complete;
bool omap_complete;
omap_complete;
}
- static void generate_test_instances(list<ObjectRecoveryProgress*>& o);
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- ostream &print(ostream &out) const;
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<ObjectRecoveryProgress*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ std::ostream &print(std::ostream &out) const;
+ void dump(ceph::Formatter *f) const;
};
WRITE_CLASS_ENCODER(ObjectRecoveryProgress)
-ostream& operator<<(ostream& out, const ObjectRecoveryProgress &prog);
+std::ostream& operator<<(std::ostream& out, const ObjectRecoveryProgress &prog);
struct PushReplyOp {
hobject_t soid;
- static void generate_test_instances(list<PushReplyOp*>& o);
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator &bl);
- ostream &print(ostream &out) const;
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<PushReplyOp*>& o);
+ void encode(ceph::buffer::list &bl) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ std::ostream &print(std::ostream &out) const;
+ void dump(ceph::Formatter *f) const;
uint64_t cost(CephContext *cct) const;
};
WRITE_CLASS_ENCODER(PushReplyOp)
-ostream& operator<<(ostream& out, const PushReplyOp &op);
+std::ostream& operator<<(std::ostream& out, const PushReplyOp &op);
struct PullOp {
hobject_t soid;
ObjectRecoveryInfo recovery_info;
ObjectRecoveryProgress recovery_progress;
- static void generate_test_instances(list<PullOp*>& o);
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl);
- ostream &print(ostream &out) const;
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<PullOp*>& o);
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ std::ostream &print(std::ostream &out) const;
+ void dump(ceph::Formatter *f) const;
uint64_t cost(CephContext *cct) const;
};
WRITE_CLASS_ENCODER_FEATURES(PullOp)
-ostream& operator<<(ostream& out, const PullOp &op);
+std::ostream& operator<<(std::ostream& out, const PullOp &op);
struct PushOp {
hobject_t soid;
eversion_t version;
- bufferlist data;
+ ceph::buffer::list data;
interval_set<uint64_t> data_included;
- bufferlist omap_header;
- map<string, bufferlist> omap_entries;
- map<string, bufferlist> attrset;
+ ceph::buffer::list omap_header;
+ std::map<std::string, ceph::buffer::list> omap_entries;
+ std::map<std::string, ceph::buffer::list> attrset;
ObjectRecoveryInfo recovery_info;
ObjectRecoveryProgress before_progress;
ObjectRecoveryProgress after_progress;
- static void generate_test_instances(list<PushOp*>& o);
- void encode(bufferlist &bl, uint64_t features) const;
- void decode(bufferlist::const_iterator &bl);
- ostream &print(ostream &out) const;
- void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<PushOp*>& o);
+ void encode(ceph::buffer::list &bl, uint64_t features) const;
+ void decode(ceph::buffer::list::const_iterator &bl);
+ std::ostream &print(std::ostream &out) const;
+ void dump(ceph::Formatter *f) const;
uint64_t cost(CephContext *cct) const;
};
WRITE_CLASS_ENCODER_FEATURES(PushOp)
-ostream& operator<<(ostream& out, const PushOp &op);
+std::ostream& operator<<(std::ostream& out, const PushOp &op);
/*
*/
struct ScrubMap {
struct object {
- map<string,bufferptr> attrs;
+ std::map<std::string, ceph::buffer::ptr> attrs;
uint64_t size;
__u32 omap_digest; ///< omap crc32c
__u32 digest; ///< data crc32c
read_error(false), stat_error(false), ec_hash_mismatch(false),
ec_size_mismatch(false), large_omap_object_found(false) {}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<object*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<object*>& o);
};
WRITE_CLASS_ENCODER(object)
- map<hobject_t,object> objects;
+ std::map<hobject_t,object> objects;
eversion_t valid_through;
eversion_t incr_since;
bool has_large_omap_object_errors:1;
swap(incr_since, r.incr_since);
}
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl, int64_t pool=-1);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<ScrubMap*>& o);
+ void encode(ceph::buffer::list& bl) const;
+ void decode(ceph::buffer::list::const_iterator& bl, int64_t pool=-1);
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<ScrubMap*>& o);
};
WRITE_CLASS_ENCODER(ScrubMap::object)
WRITE_CLASS_ENCODER(ScrubMap)
struct ScrubMapBuilder {
bool deep = false;
- vector<hobject_t> ls;
+ std::vector<hobject_t> ls;
size_t pos = 0;
int64_t data_pos = 0;
- string omap_pos;
+ std::string omap_pos;
int ret = 0;
- bufferhash data_hash, omap_hash; ///< accumulatinng hash value
+ ceph::buffer::hash data_hash, omap_hash; ///< accumulatinng hash value
uint64_t omap_keys = 0;
uint64_t omap_bytes = 0;
omap_bytes = 0;
}
- friend ostream& operator<<(ostream& out, const ScrubMapBuilder& pos) {
+ friend std::ostream& operator<<(std::ostream& out, const ScrubMapBuilder& pos) {
out << "(" << pos.pos << "/" << pos.ls.size();
if (pos.pos < pos.ls.size()) {
out << " " << pos.ls[pos.pos];
ceph_osd_op op;
sobject_t soid;
- bufferlist indata, outdata;
+ ceph::buffer::list indata, outdata;
errorcode32_t rval;
OSDOp() : rval(0) {
}
/**
- * split a bufferlist into constituent indata members of a vector of OSDOps
+ * split a ceph::buffer::list into constituent indata members of a vector of OSDOps
*
* @param ops [out] vector of OSDOps
* @param in [in] combined data buffer
*/
- static void split_osd_op_vector_in_data(vector<OSDOp>& ops, bufferlist& in);
+ static void split_osd_op_vector_in_data(std::vector<OSDOp>& ops, ceph::buffer::list& in);
/**
- * merge indata members of a vector of OSDOp into a single bufferlist
+ * merge indata members of a vector of OSDOp into a single ceph::buffer::list
*
* Notably this also encodes certain other OSDOp data into the data
* buffer, including the sobject_t soid.
* @param ops [in] vector of OSDOps
* @param out [out] combined data buffer
*/
- static void merge_osd_op_vector_in_data(vector<OSDOp>& ops, bufferlist& out);
+ static void merge_osd_op_vector_in_data(std::vector<OSDOp>& ops, ceph::buffer::list& out);
/**
- * split a bufferlist into constituent outdata members of a vector of OSDOps
+ * split a ceph::buffer::list into constituent outdata members of a vector of OSDOps
*
* @param ops [out] vector of OSDOps
* @param in [in] combined data buffer
*/
- static void split_osd_op_vector_out_data(vector<OSDOp>& ops, bufferlist& in);
+ static void split_osd_op_vector_out_data(std::vector<OSDOp>& ops, ceph::buffer::list& in);
/**
- * merge outdata members of a vector of OSDOps into a single bufferlist
+ * merge outdata members of a vector of OSDOps into a single ceph::buffer::list
*
* @param ops [in] vector of OSDOps
* @param out [out] combined data buffer
*/
- static void merge_osd_op_vector_out_data(vector<OSDOp>& ops, bufferlist& out);
+ static void merge_osd_op_vector_out_data(std::vector<OSDOp>& ops, ceph::buffer::list& out);
/**
* Clear data as much as possible, leave minimal data for historical op dump
*
* @param ops [in] vector of OSDOps
*/
- static void clear_data(vector<OSDOp>& ops);
+ static void clear_data(std::vector<OSDOp>& ops);
};
-ostream& operator<<(ostream& out, const OSDOp& op);
+std::ostream& operator<<(std::ostream& out, const OSDOp& op);
struct watch_item_t {
entity_name_t name;
: name(name), cookie(cookie), timeout_seconds(timeout),
addr(addr) { }
- void encode(bufferlist &bl, uint64_t features) const {
+ void encode(ceph::buffer::list &bl, uint64_t features) const {
ENCODE_START(2, 1, bl);
encode(name, bl);
encode(cookie, bl);
encode(addr, bl, features);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator &bl) {
+ void decode(ceph::buffer::list::const_iterator &bl) {
DECODE_START(2, bl);
decode(name, bl);
decode(cookie, bl);
*
*/
struct obj_list_watch_response_t {
- list<watch_item_t> entries;
+ std::list<watch_item_t> entries;
- void encode(bufferlist& bl, uint64_t features) const {
+ void encode(ceph::buffer::list& bl, uint64_t features) const {
ENCODE_START(1, 1, bl);
encode(entries, bl, features);
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);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->open_array_section("entries");
- for (list<watch_item_t>::const_iterator p = entries.begin(); p != entries.end(); ++p) {
+ for (std::list<watch_item_t>::const_iterator p = entries.begin(); p != entries.end(); ++p) {
f->open_object_section("watch");
f->dump_stream("watcher") << p->name;
f->dump_int("cookie", p->cookie);
}
f->close_section();
}
- static void generate_test_instances(list<obj_list_watch_response_t*>& o) {
+ static void generate_test_instances(std::list<obj_list_watch_response_t*>& o) {
entity_addr_t ea;
o.push_back(new obj_list_watch_response_t);
o.push_back(new obj_list_watch_response_t);
struct clone_info {
snapid_t cloneid;
- vector<snapid_t> snaps; // ascending
- vector< pair<uint64_t,uint64_t> > overlap;
+ std::vector<snapid_t> snaps; // ascending
+ std::vector< std::pair<uint64_t,uint64_t> > overlap;
uint64_t size;
clone_info() : cloneid(CEPH_NOSNAP), size(0) {}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(cloneid, bl);
encode(snaps, bl);
encode(size, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(1, bl);
decode(cloneid, bl);
decode(snaps, bl);
decode(size, bl);
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
if (cloneid == CEPH_NOSNAP)
f->dump_string("cloneid", "HEAD");
else
f->dump_unsigned("cloneid", cloneid.val);
f->open_array_section("snapshots");
- for (vector<snapid_t>::const_iterator p = snaps.begin(); p != snaps.end(); ++p) {
+ for (std::vector<snapid_t>::const_iterator p = snaps.begin(); p != snaps.end(); ++p) {
f->open_object_section("snap");
f->dump_unsigned("id", p->val);
f->close_section();
}
f->close_section();
f->open_array_section("overlaps");
- for (vector< pair<uint64_t,uint64_t> >::const_iterator q = overlap.begin();
+ for (std::vector< std::pair<uint64_t,uint64_t> >::const_iterator q = overlap.begin();
q != overlap.end(); ++q) {
f->open_object_section("overlap");
f->dump_unsigned("offset", q->first);
f->close_section();
f->dump_unsigned("size", size);
}
- static void generate_test_instances(list<clone_info*>& o) {
+ static void generate_test_instances(std::list<clone_info*>& o) {
o.push_back(new clone_info);
o.push_back(new clone_info);
o.back()->cloneid = 1;
o.back()->snaps.push_back(1);
- o.back()->overlap.push_back(pair<uint64_t,uint64_t>(0,4096));
- o.back()->overlap.push_back(pair<uint64_t,uint64_t>(8192,4096));
+ o.back()->overlap.push_back(std::pair<uint64_t,uint64_t>(0,4096));
+ o.back()->overlap.push_back(std::pair<uint64_t,uint64_t>(8192,4096));
o.back()->size = 16384;
o.push_back(new clone_info);
o.back()->cloneid = CEPH_NOSNAP;
*
*/
struct obj_list_snap_response_t {
- vector<clone_info> clones; // ascending
+ std::vector<clone_info> clones; // ascending
snapid_t seq;
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(2, 1, bl);
encode(clones, bl);
encode(seq, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& bl) {
+ void decode(ceph::buffer::list::const_iterator& bl) {
DECODE_START(2, bl);
decode(clones, bl);
if (struct_v >= 2)
seq = CEPH_NOSNAP;
DECODE_FINISH(bl);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->open_array_section("clones");
- for (vector<clone_info>::const_iterator p = clones.begin(); p != clones.end(); ++p) {
+ for (std::vector<clone_info>::const_iterator p = clones.begin(); p != clones.end(); ++p) {
f->open_object_section("clone");
p->dump(f);
f->close_section();
f->dump_unsigned("seq", seq);
f->close_section();
}
- static void generate_test_instances(list<obj_list_snap_response_t*>& o) {
+ static void generate_test_instances(std::list<obj_list_snap_response_t*>& o) {
o.push_back(new obj_list_snap_response_t);
o.push_back(new obj_list_snap_response_t);
clone_info cl;
cl.cloneid = 1;
cl.snaps.push_back(1);
- cl.overlap.push_back(pair<uint64_t,uint64_t>(0,4096));
- cl.overlap.push_back(pair<uint64_t,uint64_t>(8192,4096));
+ cl.overlap.push_back(std::pair<uint64_t,uint64_t>(0,4096));
+ cl.overlap.push_back(std::pair<uint64_t,uint64_t>(8192,4096));
cl.size = 16384;
o.back()->clones.push_back(cl);
cl.cloneid = CEPH_NOSNAP;
/// last epoch updated
epoch_t epoch = 0;
/// poolid -> epoch -> pg_num
- map<int64_t,map<epoch_t,uint32_t>> pg_nums;
+ std::map<int64_t, std::map<epoch_t,uint32_t>> pg_nums;
/// pair(epoch, poolid)
- set<pair<epoch_t,int64_t>> deleted_pools;
+ std::set<std::pair<epoch_t,int64_t>> deleted_pools;
void log_pg_num_change(epoch_t epoch, int64_t pool, uint32_t pg_num) {
pg_nums[pool][epoch] = pg_num;
}
void log_pool_delete(epoch_t epoch, int64_t pool) {
- deleted_pools.insert(make_pair(epoch, pool));
+ deleted_pools.insert(std::make_pair(epoch, pool));
}
/// prune history based on oldest osdmap epoch in the cluster
}
}
- void encode(bufferlist& bl) const {
+ void encode(ceph::buffer::list& bl) const {
ENCODE_START(1, 1, bl);
encode(epoch, bl);
encode(pg_nums, bl);
encode(deleted_pools, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::const_iterator& p) {
+ void decode(ceph::buffer::list::const_iterator& p) {
DECODE_START(1, p);
decode(epoch, p);
decode(pg_nums, p);
decode(deleted_pools, p);
DECODE_FINISH(p);
}
- void dump(Formatter *f) const {
+ void dump(ceph::Formatter *f) const {
f->dump_unsigned("epoch", epoch);
f->open_object_section("pools");
for (auto& i : pg_nums) {
}
f->close_section();
}
- static void generate_test_instances(list<pool_pg_num_history_t*>& ls) {
+ static void generate_test_instances(std::list<pool_pg_num_history_t*>& ls) {
ls.push_back(new pool_pg_num_history_t);
}
- friend ostream& operator<<(ostream& out, const pool_pg_num_history_t& h) {
+ friend std::ostream& operator<<(std::ostream& out, const pool_pg_num_history_t& h) {
return out << "pg_num_history(e" << h.epoch
<< " pg_nums " << h.pg_nums
<< " deleted_pools " << h.deleted_pools