]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
messages,osd: add EC messages and associated types
authorSamuel Just <sam.just@inktank.com>
Fri, 20 Dec 2013 00:15:03 +0000 (16:15 -0800)
committerSamuel Just <sam.just@inktank.com>
Tue, 18 Feb 2014 04:12:15 +0000 (20:12 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
12 files changed:
src/common/Makefile.am
src/messages/MOSDECSubOpRead.h [new file with mode: 0644]
src/messages/MOSDECSubOpReadReply.h [new file with mode: 0644]
src/messages/MOSDECSubOpWrite.h [new file with mode: 0644]
src/messages/MOSDECSubOpWriteReply.h [new file with mode: 0644]
src/messages/Makefile.am
src/msg/Message.cc
src/msg/Message.h
src/osd/ECMsgTypes.cc [new file with mode: 0644]
src/osd/ECMsgTypes.h [new file with mode: 0644]
src/osd/Makefile.am
src/test/encoding/types.h

index b8ce83be9efa0d137fb01b334b301f2132a8bbfc..f39ab4ed5c9bf5cfdc1e569ea6c838aa1d65549a 100644 (file)
@@ -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 (file)
index 0000000..99e62e6
--- /dev/null
@@ -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 (file)
index 0000000..28e2cf7
--- /dev/null
@@ -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 (file)
index 0000000..02e5368
--- /dev/null
@@ -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 (file)
index 0000000..c2edfb3
--- /dev/null
@@ -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
index c503d3fca9b5ca87eb265ff4f92a22e4a52b7419..cac40482b00d9bd232476b7df2406dbadee14f96 100644 (file)
@@ -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 \
index b9dc54848db438aa9bd2cd2ff0ed444b636fa988..6ecce716924f5d882e75c7ecd03ba36d681d4b01 100644 (file)
@@ -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;
index f345e7adaabec8e80c50b073ae90295ed21490a2..fbca242e2052a54ba3974a180387b541a03a6bbd 100644 (file)
 #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 (file)
index 0000000..87e622b
--- /dev/null
@@ -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<ECSubWrite*> &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<ECSubWriteReply*>& 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<hobject_t, list<pair<uint64_t, uint64_t> > >::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<pair<uint64_t, uint64_t> >::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<hobject_t>::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<ECSubRead*>& 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<hobject_t, list<pair<uint64_t, bufferlist> > >::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<pair<uint64_t, bufferlist> >::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<hobject_t, map<string, bufferlist> >::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<string, bufferlist>::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<hobject_t, int>::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<ECSubReadReply*>& 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 (file)
index 0000000..8b8f046
--- /dev/null
@@ -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<pg_log_entry_t> log_entries;
+  set<hobject_t> temp_removed;
+  set<hobject_t> 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<pg_log_entry_t> log_entries,
+    const set<hobject_t> &temp_removed,
+    const set<hobject_t> &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<ECSubWrite*>& 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<ECSubWriteReply*>& o);
+};
+WRITE_CLASS_ENCODER(ECSubWriteReply)
+
+struct ECSubRead {
+  pg_shard_t from;
+  tid_t tid;
+  map<hobject_t, list<pair<uint64_t, uint64_t> > > to_read;
+  set<hobject_t> attrs_to_read;
+  void encode(bufferlist &bl) const;
+  void decode(bufferlist::iterator &bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<ECSubRead*>& o);
+};
+WRITE_CLASS_ENCODER(ECSubRead)
+
+struct ECSubReadReply {
+  pg_shard_t from;
+  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::iterator &bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<ECSubReadReply*>& 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
index 70bba301d259a82f3cb1cfc72db7fabe7e43d077..ecaa9d8e989c9e72a1225a537c51d75ec59b9e9f 100644 (file)
@@ -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
 
index 2b79bfbac072b55018601afcb20c1c4a9d4882f9..ba577e1935dea1ee7c5941836d0e7929b054898f 100644 (file)
@@ -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)