mirror of
https://github.com/ceph/ceph
synced 2025-02-25 03:52:04 +00:00
osd: Update ECMsgTypes to work without using namespace
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
This commit is contained in:
parent
a7676dcd10
commit
d96e891ff9
@ -14,6 +14,14 @@
|
||||
|
||||
#include "ECMsgTypes.h"
|
||||
|
||||
using std::list;
|
||||
using std::make_pair;
|
||||
using std::map;
|
||||
using std::pair;
|
||||
using std::set;
|
||||
using ceph::bufferlist;
|
||||
using ceph::Formatter;
|
||||
|
||||
void ECSubWrite::encode(bufferlist &bl) const
|
||||
{
|
||||
ENCODE_START(4, 1, bl);
|
||||
@ -170,11 +178,9 @@ void ECSubRead::encode(bufferlist &bl, uint64_t features) const
|
||||
encode(from, bl);
|
||||
encode(tid, bl);
|
||||
map<hobject_t, list<pair<uint64_t, uint64_t> >> tmp;
|
||||
for (map<hobject_t, list<boost::tuple<uint64_t, uint64_t, uint32_t> >>::const_iterator m = to_read.begin();
|
||||
m != to_read.end(); ++m) {
|
||||
for (auto m = to_read.cbegin(); m != to_read.cend(); ++m) {
|
||||
list<pair<uint64_t, uint64_t> > tlist;
|
||||
for (list<boost::tuple<uint64_t, uint64_t, uint32_t> >::const_iterator l = m->second.begin();
|
||||
l != m->second.end(); ++l) {
|
||||
for (auto l = m->second.cbegin(); l != m->second.cend(); ++l) {
|
||||
tlist.push_back(std::make_pair(l->get<0>(), l->get<1>()));
|
||||
}
|
||||
tmp[m->first] = tlist;
|
||||
@ -203,11 +209,9 @@ void ECSubRead::decode(bufferlist::const_iterator &bl)
|
||||
if (struct_v == 1) {
|
||||
map<hobject_t, list<pair<uint64_t, uint64_t> >>tmp;
|
||||
decode(tmp, bl);
|
||||
for (map<hobject_t, list<pair<uint64_t, uint64_t> >>::const_iterator m = tmp.begin();
|
||||
m != tmp.end(); ++m) {
|
||||
for (auto m = tmp.cbegin(); m != tmp.cend(); ++m) {
|
||||
list<boost::tuple<uint64_t, uint64_t, uint32_t> > tlist;
|
||||
for (list<pair<uint64_t, uint64_t> > ::const_iterator l = m->second.begin();
|
||||
l != m->second.end(); ++l) {
|
||||
for (auto l = m->second.cbegin(); l != m->second.cend(); ++l) {
|
||||
tlist.push_back(boost::make_tuple(l->first, l->second, 0));
|
||||
}
|
||||
to_read[m->first] = tlist;
|
||||
@ -241,17 +245,11 @@ void ECSubRead::dump(Formatter *f) const
|
||||
f->dump_stream("from") << from;
|
||||
f->dump_unsigned("tid", tid);
|
||||
f->open_array_section("objects");
|
||||
for (map<hobject_t, list<boost::tuple<uint64_t, uint64_t, uint32_t> >>::const_iterator i =
|
||||
to_read.begin();
|
||||
i != to_read.end();
|
||||
++i) {
|
||||
for (auto i = to_read.cbegin(); i != to_read.cend(); ++i) {
|
||||
f->open_object_section("object");
|
||||
f->dump_stream("oid") << i->first;
|
||||
f->open_array_section("extents");
|
||||
for (list<boost::tuple<uint64_t, uint64_t, uint32_t> >::const_iterator j =
|
||||
i->second.begin();
|
||||
j != i->second.end();
|
||||
++j) {
|
||||
for (auto j = i->second.cbegin(); j != i->second.cend(); ++j) {
|
||||
f->open_object_section("extent");
|
||||
f->dump_unsigned("off", j->get<0>());
|
||||
f->dump_unsigned("len", j->get<1>());
|
||||
@ -264,9 +262,7 @@ void ECSubRead::dump(Formatter *f) const
|
||||
f->close_section();
|
||||
|
||||
f->open_array_section("object_attrs_requested");
|
||||
for (set<hobject_t>::const_iterator i = attrs_to_read.begin();
|
||||
i != attrs_to_read.end();
|
||||
++i) {
|
||||
for (auto i = attrs_to_read.cbegin(); i != attrs_to_read.cend(); ++i) {
|
||||
f->open_object_section("object");
|
||||
f->dump_stream("oid") << *i;
|
||||
f->close_section();
|
||||
@ -330,17 +326,11 @@ void ECSubReadReply::dump(Formatter *f) const
|
||||
f->dump_stream("from") << from;
|
||||
f->dump_unsigned("tid", tid);
|
||||
f->open_array_section("buffers_read");
|
||||
for (map<hobject_t, list<pair<uint64_t, bufferlist> >>::const_iterator i =
|
||||
buffers_read.begin();
|
||||
i != buffers_read.end();
|
||||
++i) {
|
||||
for (auto i = buffers_read.cbegin(); i != buffers_read.cend(); ++i) {
|
||||
f->open_object_section("object");
|
||||
f->dump_stream("oid") << i->first;
|
||||
f->open_array_section("data");
|
||||
for (list<pair<uint64_t, bufferlist> >::const_iterator j =
|
||||
i->second.begin();
|
||||
j != i->second.end();
|
||||
++j) {
|
||||
for (auto j = i->second.cbegin(); j != i->second.cend(); ++j) {
|
||||
f->open_object_section("extent");
|
||||
f->dump_unsigned("off", j->first);
|
||||
f->dump_unsigned("buf_len", j->second.length());
|
||||
@ -352,16 +342,11 @@ void ECSubReadReply::dump(Formatter *f) const
|
||||
f->close_section();
|
||||
|
||||
f->open_array_section("attrs_returned");
|
||||
for (map<hobject_t, map<string, bufferlist>>::const_iterator i =
|
||||
attrs_read.begin();
|
||||
i != attrs_read.end();
|
||||
++i) {
|
||||
for (auto i = attrs_read.cbegin(); i != attrs_read.cend(); ++i) {
|
||||
f->open_object_section("object_attrs");
|
||||
f->dump_stream("oid") << i->first;
|
||||
f->open_array_section("attrs");
|
||||
for (map<string, bufferlist>::const_iterator j = i->second.begin();
|
||||
j != i->second.end();
|
||||
++j) {
|
||||
for (auto j = i->second.cbegin(); j != i->second.cend(); ++j) {
|
||||
f->open_object_section("attr");
|
||||
f->dump_string("attr", j->first);
|
||||
f->dump_unsigned("val_len", j->second.length());
|
||||
@ -373,9 +358,7 @@ void ECSubReadReply::dump(Formatter *f) const
|
||||
f->close_section();
|
||||
|
||||
f->open_array_section("errors");
|
||||
for (map<hobject_t, int>::const_iterator i = errors.begin();
|
||||
i != errors.end();
|
||||
++i) {
|
||||
for (auto i = errors.cbegin(); i != errors.cend(); ++i) {
|
||||
f->open_object_section("error_pair");
|
||||
f->dump_stream("oid") << i->first;
|
||||
f->dump_int("error", i->second);
|
||||
|
@ -31,8 +31,8 @@ struct ECSubWrite {
|
||||
eversion_t trim_to;
|
||||
eversion_t roll_forward_to;
|
||||
vector<pg_log_entry_t> log_entries;
|
||||
set<hobject_t> temp_added;
|
||||
set<hobject_t> temp_removed;
|
||||
std::set<hobject_t> temp_added;
|
||||
std::set<hobject_t> temp_removed;
|
||||
boost::optional<pg_hit_set_history_t> updated_hit_set_history;
|
||||
bool backfill_or_async_recovery = false;
|
||||
ECSubWrite() : tid(0) {}
|
||||
@ -48,8 +48,8 @@ struct ECSubWrite {
|
||||
eversion_t roll_forward_to,
|
||||
vector<pg_log_entry_t> log_entries,
|
||||
boost::optional<pg_hit_set_history_t> updated_hit_set_history,
|
||||
const set<hobject_t> &temp_added,
|
||||
const set<hobject_t> &temp_removed,
|
||||
const std::set<hobject_t> &temp_added,
|
||||
const std::set<hobject_t> &temp_removed,
|
||||
bool backfill_or_async_recovery)
|
||||
: from(from), tid(tid), reqid(reqid),
|
||||
soid(soid), stats(stats), t(t),
|
||||
@ -77,10 +77,10 @@ struct ECSubWrite {
|
||||
updated_hit_set_history = other.updated_hit_set_history;
|
||||
backfill_or_async_recovery = other.backfill_or_async_recovery;
|
||||
}
|
||||
void encode(bufferlist &bl) const;
|
||||
void decode(bufferlist::const_iterator &bl);
|
||||
void dump(Formatter *f) const;
|
||||
static void generate_test_instances(list<ECSubWrite*>& 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<ECSubWrite*>& o);
|
||||
private:
|
||||
// no outside copying -- slow
|
||||
ECSubWrite(ECSubWrite& other);
|
||||
@ -95,36 +95,36 @@ struct ECSubWriteReply {
|
||||
bool committed;
|
||||
bool applied;
|
||||
ECSubWriteReply() : tid(0), committed(false), applied(false) {}
|
||||
void encode(bufferlist &bl) const;
|
||||
void decode(bufferlist::const_iterator &bl);
|
||||
void dump(Formatter *f) const;
|
||||
static void generate_test_instances(list<ECSubWriteReply*>& 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<ECSubWriteReply*>& o);
|
||||
};
|
||||
WRITE_CLASS_ENCODER(ECSubWriteReply)
|
||||
|
||||
struct ECSubRead {
|
||||
pg_shard_t from;
|
||||
ceph_tid_t tid;
|
||||
map<hobject_t, list<boost::tuple<uint64_t, uint64_t, uint32_t> >> to_read;
|
||||
set<hobject_t> attrs_to_read;
|
||||
map<hobject_t, vector<pair<int, int>>> subchunks;
|
||||
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<ECSubRead*>& o);
|
||||
std::map<hobject_t, std::list<boost::tuple<uint64_t, uint64_t, uint32_t> >> to_read;
|
||||
std::set<hobject_t> attrs_to_read;
|
||||
std::map<hobject_t, std::vector<std::pair<int, int>>> subchunks;
|
||||
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<ECSubRead*>& o);
|
||||
};
|
||||
WRITE_CLASS_ENCODER_FEATURES(ECSubRead)
|
||||
|
||||
struct ECSubReadReply {
|
||||
pg_shard_t from;
|
||||
ceph_tid_t tid;
|
||||
map<hobject_t, list<pair<uint64_t, bufferlist> >> buffers_read;
|
||||
map<hobject_t, map<string, bufferlist>> attrs_read;
|
||||
map<hobject_t, int> errors;
|
||||
void encode(bufferlist &bl) const;
|
||||
void decode(bufferlist::const_iterator &bl);
|
||||
void dump(Formatter *f) const;
|
||||
static void generate_test_instances(list<ECSubReadReply*>& o);
|
||||
std::map<hobject_t, std::list<std::pair<uint64_t, ceph::buffer::list> >> buffers_read;
|
||||
std::map<hobject_t, std::map<string, ceph::buffer::list>> attrs_read;
|
||||
std::map<hobject_t, int> errors;
|
||||
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<ECSubReadReply*>& o);
|
||||
};
|
||||
WRITE_CLASS_ENCODER(ECSubReadReply)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user