From 6cd64a507d0e664fdca44c9d4dc9078c8b15cc96 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 19 Dec 2013 16:15:03 -0800 Subject: [PATCH] messages,osd: add EC messages and associated types Signed-off-by: Samuel Just --- src/common/Makefile.am | 1 + src/messages/MOSDECSubOpRead.h | 62 +++++ src/messages/MOSDECSubOpReadReply.h | 62 +++++ src/messages/MOSDECSubOpWrite.h | 65 ++++++ src/messages/MOSDECSubOpWriteReply.h | 62 +++++ src/messages/Makefile.am | 4 + src/msg/Message.cc | 17 ++ src/msg/Message.h | 5 + src/osd/ECMsgTypes.cc | 333 +++++++++++++++++++++++++++ src/osd/ECMsgTypes.h | 108 +++++++++ src/osd/Makefile.am | 2 + src/test/encoding/types.h | 6 + 12 files changed, 727 insertions(+) create mode 100644 src/messages/MOSDECSubOpRead.h create mode 100644 src/messages/MOSDECSubOpReadReply.h create mode 100644 src/messages/MOSDECSubOpWrite.h create mode 100644 src/messages/MOSDECSubOpWriteReply.h create mode 100644 src/osd/ECMsgTypes.cc create mode 100644 src/osd/ECMsgTypes.h diff --git a/src/common/Makefile.am b/src/common/Makefile.am index b8ce83be9efa0..f39ab4ed5c9bf 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -83,6 +83,7 @@ libcommon_la_SOURCES += \ mon/MonMap.cc \ osd/OSDMap.cc \ osd/osd_types.cc \ + osd/ECMsgTypes.cc \ osd/HitSet.cc \ mds/MDSMap.cc \ mds/inode_backtrace.cc \ diff --git a/src/messages/MOSDECSubOpRead.h b/src/messages/MOSDECSubOpRead.h new file mode 100644 index 0000000000000..99e62e6c48a67 --- /dev/null +++ b/src/messages/MOSDECSubOpRead.h @@ -0,0 +1,62 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Inktank Storage, Inc. + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef MOSDECSUBOPREAD_H +#define MOSDECSUBOPREAD_H + +#include "msg/Message.h" +#include "osd/osd_types.h" +#include "osd/ECMsgTypes.h" + +class MOSDECSubOpRead : public Message { + static const int HEAD_VERSION = 1; + static const int COMPAT_VERSION = 1; + +public: + spg_t pgid; + epoch_t map_epoch; + ECSubRead op; + + int get_cost() const { + return 0; + } + + MOSDECSubOpRead() : + Message(MSG_OSD_EC_READ, HEAD_VERSION, COMPAT_VERSION) + {} + + virtual void decode_payload() { + bufferlist::iterator p = payload.begin(); + ::decode(pgid, p); + ::decode(map_epoch, p); + ::decode(op, p); + } + + virtual void encode_payload(uint64_t features) { + ::encode(pgid, payload); + ::encode(map_epoch, payload); + ::encode(op, payload); + } + + const char *get_type_name() const { return "MOSDECSubOpRead"; } + + void print(ostream& out) const { + out << "MOSDECSubOpRead(" << pgid + << " " << map_epoch + << " " << op; + out << ")"; + } +}; + +#endif diff --git a/src/messages/MOSDECSubOpReadReply.h b/src/messages/MOSDECSubOpReadReply.h new file mode 100644 index 0000000000000..28e2cf7e9291e --- /dev/null +++ b/src/messages/MOSDECSubOpReadReply.h @@ -0,0 +1,62 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Inktank Storage, Inc. + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef MOSDECSUBOPREADREPLY_H +#define MOSDECSUBOPREADREPLY_H + +#include "msg/Message.h" +#include "osd/osd_types.h" +#include "osd/ECMsgTypes.h" + +class MOSDECSubOpReadReply : public Message { + static const int HEAD_VERSION = 1; + static const int COMPAT_VERSION = 1; + +public: + spg_t pgid; + epoch_t map_epoch; + ECSubReadReply op; + + int get_cost() const { + return 0; + } + + MOSDECSubOpReadReply() : + Message(MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION) + {} + + virtual void decode_payload() { + bufferlist::iterator p = payload.begin(); + ::decode(pgid, p); + ::decode(map_epoch, p); + ::decode(op, p); + } + + virtual void encode_payload(uint64_t features) { + ::encode(pgid, payload); + ::encode(map_epoch, payload); + ::encode(op, payload); + } + + const char *get_type_name() const { return "MOSDECSubOpReadReply"; } + + void print(ostream& out) const { + out << "MOSDECSubOpReadReply(" << pgid + << " " << map_epoch + << " " << op; + out << ")"; + } +}; + +#endif diff --git a/src/messages/MOSDECSubOpWrite.h b/src/messages/MOSDECSubOpWrite.h new file mode 100644 index 0000000000000..02e5368582445 --- /dev/null +++ b/src/messages/MOSDECSubOpWrite.h @@ -0,0 +1,65 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Inktank Storage, Inc. + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef MOSDECSUBOPWRITE_H +#define MOSDECSUBOPWRITE_H + +#include "msg/Message.h" +#include "osd/osd_types.h" +#include "osd/ECMsgTypes.h" + +class MOSDECSubOpWrite : public Message { + static const int HEAD_VERSION = 1; + static const int COMPAT_VERSION = 1; + +public: + spg_t pgid; + epoch_t map_epoch; + ECSubWrite op; + + int get_cost() const { + return 0; + } + + MOSDECSubOpWrite() + : Message(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) + {} + MOSDECSubOpWrite(ECSubWrite &op) + : Message(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION), + op(op) {} + + virtual void decode_payload() { + bufferlist::iterator p = payload.begin(); + ::decode(pgid, p); + ::decode(map_epoch, p); + ::decode(op, p); + } + + virtual void encode_payload(uint64_t features) { + ::encode(pgid, payload); + ::encode(map_epoch, payload); + ::encode(op, payload); + } + + const char *get_type_name() const { return "MOSDECSubOpWrite"; } + + void print(ostream& out) const { + out << "MOSDECSubOpWrite(" << pgid + << " " << map_epoch + << " " << op; + out << ")"; + } +}; + +#endif diff --git a/src/messages/MOSDECSubOpWriteReply.h b/src/messages/MOSDECSubOpWriteReply.h new file mode 100644 index 0000000000000..c2edfb38c3e84 --- /dev/null +++ b/src/messages/MOSDECSubOpWriteReply.h @@ -0,0 +1,62 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Inktank Storage, Inc. + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef MOSDECSUBOPWRITEREPLY_H +#define MOSDECSUBOPWRITEREPLY_H + +#include "msg/Message.h" +#include "osd/osd_types.h" +#include "osd/ECMsgTypes.h" + +class MOSDECSubOpWriteReply : public Message { + static const int HEAD_VERSION = 1; + static const int COMPAT_VERSION = 1; + +public: + spg_t pgid; + epoch_t map_epoch; + ECSubWriteReply op; + + int get_cost() const { + return 0; + } + + MOSDECSubOpWriteReply() : + Message(MSG_OSD_EC_WRITE_REPLY, HEAD_VERSION, COMPAT_VERSION) + {} + + virtual void decode_payload() { + bufferlist::iterator p = payload.begin(); + ::decode(pgid, p); + ::decode(map_epoch, p); + ::decode(op, p); + } + + virtual void encode_payload(uint64_t features) { + ::encode(pgid, payload); + ::encode(map_epoch, payload); + ::encode(op, payload); + } + + const char *get_type_name() const { return "MOSDECSubOpWriteReply"; } + + void print(ostream& out) const { + out << "MOSDECSubOpWriteReply(" << pgid + << " " << map_epoch + << " " << op; + out << ")"; + } +}; + +#endif diff --git a/src/messages/Makefile.am b/src/messages/Makefile.am index c503d3fca9b5c..cac40482b00d9 100644 --- a/src/messages/Makefile.am +++ b/src/messages/Makefile.am @@ -87,6 +87,10 @@ noinst_HEADERS += \ messages/MOSDPGQuery.h \ messages/MOSDPGRemove.h \ messages/MOSDPGScan.h \ + messages/MOSDECSubOpWrite.h \ + messages/MOSDECSubOpWriteReply.h \ + messages/MOSDECSubOpRead.h \ + messages/MOSDECSubOpReadReply.h \ messages/MBackfillReserve.h \ messages/MRecoveryReserve.h \ messages/MMonQuorumService.h \ diff --git a/src/msg/Message.cc b/src/msg/Message.cc index b9dc54848db43..6ecce716924f5 100644 --- a/src/msg/Message.cc +++ b/src/msg/Message.cc @@ -159,6 +159,11 @@ using namespace std; #include "messages/MOSDPGPushReply.h" #include "messages/MOSDPGPull.h" +#include "messages/MOSDECSubOpWrite.h" +#include "messages/MOSDECSubOpWriteReply.h" +#include "messages/MOSDECSubOpRead.h" +#include "messages/MOSDECSubOpReadReply.h" + #define DEBUGLVL 10 // debug level of output #define dout_subsys ceph_subsys_ms @@ -466,6 +471,18 @@ Message *decode_message(CephContext *cct, ceph_msg_header& header, ceph_msg_foot case MSG_OSD_PG_PUSH_REPLY: m = new MOSDPGPushReply; break; + case MSG_OSD_EC_WRITE: + m = new MOSDECSubOpWrite; + break; + case MSG_OSD_EC_WRITE_REPLY: + m = new MOSDECSubOpWriteReply; + break; + case MSG_OSD_EC_READ: + m = new MOSDECSubOpRead; + break; + case MSG_OSD_EC_READ_REPLY: + m = new MOSDECSubOpReadReply; + break; // auth case CEPH_MSG_AUTH: m = new MAuth; diff --git a/src/msg/Message.h b/src/msg/Message.h index f345e7adaabec..fbca242e2052a 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -107,6 +107,11 @@ #define MSG_OSD_PG_PULL 106 #define MSG_OSD_PG_PUSH_REPLY 107 +#define MSG_OSD_EC_WRITE 108 +#define MSG_OSD_EC_WRITE_REPLY 109 +#define MSG_OSD_EC_READ 110 +#define MSG_OSD_EC_READ_REPLY 111 + // *** MDS *** #define MSG_MDS_BEACON 100 // to monitor diff --git a/src/osd/ECMsgTypes.cc b/src/osd/ECMsgTypes.cc new file mode 100644 index 0000000000000..87e622b0bf1af --- /dev/null +++ b/src/osd/ECMsgTypes.cc @@ -0,0 +1,333 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Inktank Storage, Inc. + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#include "ECMsgTypes.h" + +void ECSubWrite::encode(bufferlist &bl) const +{ + ENCODE_START(1, 1, bl); + ::encode(from, bl); + ::encode(tid, bl); + ::encode(reqid, bl); + ::encode(soid, bl); + ::encode(stats, bl); + ::encode(t, bl); + ::encode(at_version, bl); + ::encode(trim_to, bl); + ::encode(log_entries, bl); + ::encode(temp_added, bl); + ::encode(temp_removed, bl); + ENCODE_FINISH(bl); +} + +void ECSubWrite::decode(bufferlist::iterator &bl) +{ + DECODE_START(1, bl); + ::decode(from, bl); + ::decode(tid, bl); + ::decode(reqid, bl); + ::decode(soid, bl); + ::decode(stats, bl); + ::decode(t, bl); + ::decode(at_version, bl); + ::decode(trim_to, bl); + ::decode(log_entries, bl); + ::decode(temp_added, bl); + ::decode(temp_removed, bl); + DECODE_FINISH(bl); +} + +std::ostream &operator<<( + std::ostream &lhs, const ECSubWrite &rhs) +{ + return lhs + << "ECSubWrite(tid=" << rhs.tid + << ", reqid=" << rhs.reqid + << ", at_version=" << rhs.at_version + << ", trim_to=" << rhs.trim_to << ")"; +} + +void ECSubWrite::dump(Formatter *f) const +{ + f->dump_stream("tid") << tid; + f->dump_stream("reqid") << reqid; + f->dump_stream("at_version") << at_version; + f->dump_stream("trim_to") << trim_to; +} + +void ECSubWrite::generate_test_instances(list &o) +{ + o.push_back(new ECSubWrite()); + o.back()->tid = 1; + o.back()->at_version = eversion_t(2, 100); + o.back()->trim_to = eversion_t(1, 40); + o.push_back(new ECSubWrite()); + o.back()->tid = 4; + o.back()->reqid = osd_reqid_t(entity_name_t::CLIENT(123), 1, 45678); + o.back()->at_version = eversion_t(10, 300); + o.back()->trim_to = eversion_t(5, 42); +} + +void ECSubWriteReply::encode(bufferlist &bl) const +{ + ENCODE_START(1, 1, bl); + ::encode(from, bl); + ::encode(tid, bl); + ::encode(last_complete, bl); + ::encode(committed, bl); + ::encode(applied, bl); + ENCODE_FINISH(bl); +} + +void ECSubWriteReply::decode(bufferlist::iterator &bl) +{ + DECODE_START(1, bl); + ::decode(from, bl); + ::decode(tid, bl); + ::decode(last_complete, bl); + ::decode(committed, bl); + ::decode(applied, bl); + DECODE_FINISH(bl); +} + +std::ostream &operator<<( + std::ostream &lhs, const ECSubWriteReply &rhs) +{ + return lhs + << "ECSubWriteReply(tid=" << rhs.tid + << ", last_complete=" << rhs.last_complete + << ", committed=" << rhs.committed + << ", applied=" << rhs.applied << ")"; +} + +void ECSubWriteReply::dump(Formatter *f) const +{ + f->dump_stream("tid") << tid; + f->dump_stream("last_complete") << last_complete; + f->dump_stream("committed") << committed; + f->dump_stream("applied") << applied; +} + +void ECSubWriteReply::generate_test_instances(list& o) +{ + o.push_back(new ECSubWriteReply()); + o.back()->tid = 20; + o.back()->last_complete = eversion_t(100, 2000); + o.back()->committed = true; + o.push_back(new ECSubWriteReply()); + o.back()->tid = 80; + o.back()->last_complete = eversion_t(50, 200); + o.back()->applied = true; +} + +void ECSubRead::encode(bufferlist &bl) const +{ + ENCODE_START(1, 1, bl); + ::encode(from, bl); + ::encode(tid, bl); + ::encode(to_read, bl); + ::encode(attrs_to_read, bl); + ENCODE_FINISH(bl); +} + +void ECSubRead::decode(bufferlist::iterator &bl) +{ + DECODE_START(1, bl); + ::decode(from, bl); + ::decode(tid, bl); + ::decode(to_read, bl); + ::decode(attrs_to_read, bl); + DECODE_FINISH(bl); +} + +std::ostream &operator<<( + std::ostream &lhs, const ECSubRead &rhs) +{ + return lhs + << "ECSubRead(tid=" << rhs.tid + << ", to_read=" << rhs.to_read + << ", attrs_to_read=" << rhs.attrs_to_read << ")"; +} + +void ECSubRead::dump(Formatter *f) const +{ + f->dump_stream("from") << from; + f->dump_stream("tid") << tid; + f->open_array_section("objects"); + for (map > >::const_iterator i = + to_read.begin(); + i != to_read.end(); + ++i) { + f->open_object_section("object"); + f->dump_stream("oid") << i->first; + f->open_array_section("extents"); + for (list >::const_iterator j = + i->second.begin(); + j != i->second.end(); + ++j) { + f->open_object_section("extent"); + f->dump_unsigned("off", j->first); + f->dump_unsigned("len", j->second); + f->close_section(); + } + f->close_section(); + f->close_section(); + } + f->close_section(); + + f->open_array_section("object_attrs_requested"); + for (set::const_iterator i = attrs_to_read.begin(); + i != attrs_to_read.end(); + ++i) { + f->open_object_section("object"); + f->dump_stream("oid") << *i; + f->close_section(); + } + f->close_section(); +} + +void ECSubRead::generate_test_instances(list& o) +{ + hobject_t hoid1(sobject_t("asdf", 1)); + hobject_t hoid2(sobject_t("asdf2", CEPH_NOSNAP)); + o.push_back(new ECSubRead()); + o.back()->from = pg_shard_t(2, 255); + o.back()->tid = 1; + o.back()->to_read[hoid1].push_back(make_pair(100, 200)); + o.back()->to_read[hoid1].push_back(make_pair(400, 600)); + o.back()->to_read[hoid2].push_back(make_pair(400, 600)); + o.back()->attrs_to_read.insert(hoid1); + o.push_back(new ECSubRead()); + o.back()->from = pg_shard_t(2, 255); + o.back()->tid = 300; + o.back()->to_read[hoid1].push_back(make_pair(300, 200)); + o.back()->to_read[hoid2].push_back(make_pair(400, 600)); + o.back()->to_read[hoid2].push_back(make_pair(2000, 600)); + o.back()->attrs_to_read.insert(hoid2); +} + +void ECSubReadReply::encode(bufferlist &bl) const +{ + ENCODE_START(1, 1, bl); + ::encode(from, bl); + ::encode(tid, bl); + ::encode(buffers_read, bl); + ::encode(attrs_read, bl); + ::encode(errors, bl); + ENCODE_FINISH(bl); +} + +void ECSubReadReply::decode(bufferlist::iterator &bl) +{ + DECODE_START(1, bl); + ::decode(from, bl); + ::decode(tid, bl); + ::decode(buffers_read, bl); + ::decode(attrs_read, bl); + ::decode(errors, bl); + DECODE_FINISH(bl); +} + +std::ostream &operator<<( + std::ostream &lhs, const ECSubReadReply &rhs) +{ + return lhs + << "ECSubReadReply(tid=" << rhs.tid + << ", attrs_read=" << rhs.attrs_read.size() + << ")"; +} + +void ECSubReadReply::dump(Formatter *f) const +{ + f->dump_stream("from") << from; + f->dump_stream("tid") << tid; + f->open_array_section("buffers_read"); + for (map > >::const_iterator i = + buffers_read.begin(); + i != buffers_read.end(); + ++i) { + f->open_object_section("object"); + f->dump_stream("oid") << i->first; + f->open_array_section("data"); + for (list >::const_iterator j = + i->second.begin(); + j != i->second.end(); + ++j) { + f->open_object_section("extent"); + f->dump_unsigned("off", j->first); + f->dump_unsigned("buf_len", j->second.length()); + f->close_section(); + } + f->close_section(); + f->close_section(); + } + f->close_section(); + + f->open_array_section("attrs_returned"); + for (map >::const_iterator i = + attrs_read.begin(); + i != attrs_read.end(); + ++i) { + f->open_object_section("object_attrs"); + f->dump_stream("oid") << i->first; + f->open_array_section("attrs"); + for (map::const_iterator j = i->second.begin(); + j != i->second.end(); + ++j) { + f->open_object_section("attr"); + f->dump_string("attr", j->first); + f->dump_unsigned("val_len", j->second.length()); + f->close_section(); + } + f->close_section(); + f->close_section(); + } + f->close_section(); + + f->open_array_section("errors"); + for (map::const_iterator i = errors.begin(); + i != errors.end(); + ++i) { + f->open_object_section("error_pair"); + f->dump_stream("oid") << i->first; + f->dump_int("error", i->second); + f->close_section(); + } + f->close_section(); +} + +void ECSubReadReply::generate_test_instances(list& o) +{ + hobject_t hoid1(sobject_t("asdf", 1)); + hobject_t hoid2(sobject_t("asdf2", CEPH_NOSNAP)); + bufferlist bl; + bl.append_zero(100); + bufferlist bl2; + bl2.append_zero(200); + o.push_back(new ECSubReadReply()); + o.back()->from = pg_shard_t(2, 255); + o.back()->tid = 1; + o.back()->buffers_read[hoid1].push_back(make_pair(20, bl)); + o.back()->buffers_read[hoid1].push_back(make_pair(2000, bl2)); + o.back()->buffers_read[hoid2].push_back(make_pair(0, bl)); + o.back()->attrs_read[hoid1]["foo"] = bl; + o.back()->attrs_read[hoid1]["_"] = bl2; + o.push_back(new ECSubReadReply()); + o.back()->from = pg_shard_t(2, 255); + o.back()->tid = 300; + o.back()->buffers_read[hoid2].push_back(make_pair(0, bl2)); + o.back()->attrs_read[hoid2]["foo"] = bl; + o.back()->attrs_read[hoid2]["_"] = bl2; + o.back()->errors[hoid1] = -2; +} diff --git a/src/osd/ECMsgTypes.h b/src/osd/ECMsgTypes.h new file mode 100644 index 0000000000000..8b8f046d230bc --- /dev/null +++ b/src/osd/ECMsgTypes.h @@ -0,0 +1,108 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Inktank Storage, Inc. + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef ECBMSGTYPES_H +#define ECBMSGTYPES_H + +#include "osd_types.h" +#include "include/buffer.h" +#include "os/ObjectStore.h" + +struct ECSubWrite { + pg_shard_t from; + tid_t tid; + osd_reqid_t reqid; + hobject_t soid; + pg_stat_t stats; + ObjectStore::Transaction t; + eversion_t at_version; + eversion_t trim_to; + vector log_entries; + set temp_removed; + set temp_added; + ECSubWrite() {} + ECSubWrite( + pg_shard_t from, + tid_t tid, + osd_reqid_t reqid, + hobject_t soid, + pg_stat_t stats, + ObjectStore::Transaction t, + eversion_t at_version, + eversion_t trim_to, + vector log_entries, + const set &temp_removed, + const set &temp_added) + : from(from), tid(tid), reqid(reqid), + soid(soid), stats(stats), t(t), + at_version(at_version), + trim_to(trim_to), log_entries(log_entries), + temp_removed(temp_removed), + temp_added(temp_added) {} + void encode(bufferlist &bl) const; + void decode(bufferlist::iterator &bl); + void dump(Formatter *f) const; + static void generate_test_instances(list& o); +}; +WRITE_CLASS_ENCODER(ECSubWrite) + +struct ECSubWriteReply { + pg_shard_t from; + tid_t tid; + eversion_t last_complete; + bool committed; + bool applied; + ECSubWriteReply() : committed(false), applied(false) {} + void encode(bufferlist &bl) const; + void decode(bufferlist::iterator &bl); + void dump(Formatter *f) const; + static void generate_test_instances(list& o); +}; +WRITE_CLASS_ENCODER(ECSubWriteReply) + +struct ECSubRead { + pg_shard_t from; + tid_t tid; + map > > to_read; + set attrs_to_read; + void encode(bufferlist &bl) const; + void decode(bufferlist::iterator &bl); + void dump(Formatter *f) const; + static void generate_test_instances(list& o); +}; +WRITE_CLASS_ENCODER(ECSubRead) + +struct ECSubReadReply { + pg_shard_t from; + tid_t tid; + map > > buffers_read; + map > attrs_read; + map errors; + void encode(bufferlist &bl) const; + void decode(bufferlist::iterator &bl); + void dump(Formatter *f) const; + static void generate_test_instances(list& o); +}; +WRITE_CLASS_ENCODER(ECSubReadReply) + +std::ostream &operator<<( + std::ostream &lhs, const ECSubWrite &rhs); +std::ostream &operator<<( + std::ostream &lhs, const ECSubWriteReply &rhs); +std::ostream &operator<<( + std::ostream &lhs, const ECSubRead &rhs); +std::ostream &operator<<( + std::ostream &lhs, const ECSubReadReply &rhs); + +#endif diff --git a/src/osd/Makefile.am b/src/osd/Makefile.am index 70bba301d259a..ecaa9d8e989c9 100644 --- a/src/osd/Makefile.am +++ b/src/osd/Makefile.am @@ -4,6 +4,7 @@ libosd_la_SOURCES = \ osd/ReplicatedPG.cc \ osd/ReplicatedBackend.cc \ osd/ECBackend.cc \ + osd/ECMsgTypes.cc \ osd/PGBackend.cc \ osd/Ager.cc \ osd/HitSet.cc \ @@ -36,6 +37,7 @@ noinst_HEADERS += \ osd/ReplicatedBackend.h \ osd/TierAgentState.h \ osd/ECBackend.h \ + osd/ECMsgTypes.h \ osd/Watch.h \ osd/osd_types.h diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index 2b79bfbac072b..ba577e1935dea 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -82,6 +82,12 @@ TYPE(PullOp) TYPE(PushOp) TYPE(PushReplyOp) +#include "osd/ECMsgTypes.h" +TYPE(ECSubWrite) +TYPE(ECSubWriteReply) +TYPE(ECSubRead) +TYPE(ECSubReadReply) + #include "osd/HitSet.h" TYPE(ExplicitHashHitSet) TYPE(ExplicitObjectHitSet) -- 2.39.5