]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: Move the EC factory code into separate header files
authorBassam Tabbara <bassam.tabbara@quantum.com>
Mon, 19 Sep 2016 18:19:37 +0000 (11:19 -0700)
committerBassam Tabbara <bassam.tabbara@quantum.com>
Thu, 29 Sep 2016 17:34:34 +0000 (10:34 -0700)
This helps the EC factories be invokable directly for testing
and other uses.

Signed-off-by: Bassam Tabbara <bassam.tabbara@quantum.com>
src/erasure-code/isa/ErasureCodePluginIsa.cc
src/erasure-code/isa/ErasureCodePluginIsa.h [new file with mode: 0644]
src/erasure-code/jerasure/ErasureCodePluginJerasure.cc
src/erasure-code/jerasure/ErasureCodePluginJerasure.h [new file with mode: 0644]
src/erasure-code/lrc/ErasureCodePluginLrc.cc
src/erasure-code/lrc/ErasureCodePluginLrc.h [new file with mode: 0644]
src/erasure-code/shec/ErasureCodePluginShec.cc
src/erasure-code/shec/ErasureCodePluginShec.h [new file with mode: 0644]

index 611d76b07706c7b3842aaa08b3625db167ac679e..c4c37b1bf1d0f2e92c1da053967c967441bef443 100644 (file)
 // -----------------------------------------------------------------------------
 #include "ceph_ver.h"
 #include "common/debug.h"
-#include "erasure-code/ErasureCodePlugin.h"
-#include "ErasureCodeIsaTableCache.h"
+#include "ErasureCodePluginIsa.h"
 #include "ErasureCodeIsa.h"
 // -----------------------------------------------------------------------------
 
-class ErasureCodePluginIsa : public ErasureCodePlugin {
-public:
-  ErasureCodeIsaTableCache tcache;
-
-  virtual int factory(const std::string &directory,
+int ErasureCodePluginIsa::factory(const std::string &directory,
                      ErasureCodeProfile &profile,
                       ErasureCodeInterfaceRef *erasure_code,
                       ostream *ss)
-  {
+{
     ErasureCodeIsa *interface;
     std::string t;
     if (profile.find("technique") == profile.end())
@@ -68,8 +63,7 @@ public:
     }
     *erasure_code = ErasureCodeInterfaceRef(interface);
     return 0;
-  }
-};
+}
 
 // -----------------------------------------------------------------------------
 
diff --git a/src/erasure-code/isa/ErasureCodePluginIsa.h b/src/erasure-code/isa/ErasureCodePluginIsa.h
new file mode 100644 (file)
index 0000000..7ed5aed
--- /dev/null
@@ -0,0 +1,34 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph distributed storage system
+ *
+ * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
+ * Copyright (C) 2014 Red Hat <contact@redhat.com>
+ *
+ * Author: Loic Dachary <loic@dachary.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ * 
+ */
+
+#ifndef CEPH_ERASURE_CODE_PLUGIN_ISA_H
+#define CEPH_ERASURE_CODE_PLUGIN_ISA_H
+
+#include "erasure-code/ErasureCodePlugin.h"
+#include "ErasureCodeIsaTableCache.h"
+
+class ErasureCodePluginIsa : public ErasureCodePlugin {
+public:
+  ErasureCodeIsaTableCache tcache;
+
+  virtual int factory(const std::string &directory,
+                     ErasureCodeProfile &profile,
+                     ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss);
+};
+
+#endif
index 3ae4366635b56c9c6e5f3d302e0977be9e0cb40f..6029eef4ea9d3e05a7b3fa1d480d711cb9b156b6 100644 (file)
@@ -17,8 +17,8 @@
 
 #include "ceph_ver.h"
 #include "common/debug.h"
-#include "erasure-code/ErasureCodePlugin.h"
 #include "ErasureCodeJerasure.h"
+#include "ErasureCodePluginJerasure.h"
 #include "jerasure_init.h"
 
 #define dout_subsys ceph_subsys_osd
@@ -30,9 +30,7 @@ static ostream& _prefix(std::ostream* _dout)
   return *_dout << "ErasureCodePluginJerasure: ";
 }
 
-class ErasureCodePluginJerasure : public ErasureCodePlugin {
-public:
-  virtual int factory(const std::string& directory,
+int ErasureCodePluginJerasure::factory(const std::string& directory,
                      ErasureCodeProfile &profile,
                      ErasureCodeInterfaceRef *erasure_code,
                      ostream *ss) {
@@ -70,8 +68,7 @@ public:
     }
     *erasure_code = ErasureCodeInterfaceRef(interface);
     return 0;
-  }
-};
+}
 
 const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
 
diff --git a/src/erasure-code/jerasure/ErasureCodePluginJerasure.h b/src/erasure-code/jerasure/ErasureCodePluginJerasure.h
new file mode 100644 (file)
index 0000000..b52da8b
--- /dev/null
@@ -0,0 +1,31 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph distributed storage system
+ *
+ * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
+ * Copyright (C) 2014 Red Hat <contact@redhat.com>
+ *
+ * Author: Loic Dachary <loic@dachary.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ * 
+ */
+
+#ifndef CEPH_ERASURE_CODE_PLUGIN_JERASURE_H
+#define CEPH_ERASURE_CODE_PLUGIN_JERASURE_H
+
+#include "erasure-code/ErasureCodePlugin.h"
+
+class ErasureCodePluginJerasure : public ErasureCodePlugin {
+public:
+  virtual int factory(const std::string& directory,
+                     ErasureCodeProfile &profile,
+                     ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss);
+};
+
+#endif
index 5f22cc6bf90726b8aa6a0c3a1b5bf7c41040fa10..003b3dc19ddef90101191c553f30aca99a8f595a 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "ceph_ver.h"
 #include "common/debug.h"
-#include "erasure-code/ErasureCodePlugin.h"
+#include "ErasureCodePluginLrc.h"
 #include "ErasureCodeLrc.h"
 
 // re-include our assert
@@ -27,9 +27,7 @@
 #undef dout_prefix
 #define dout_prefix _prefix(_dout)
 
-class ErasureCodePluginLrc : public ErasureCodePlugin {
-public:
-  virtual int factory(const std::string &directory,
+int ErasureCodePluginLrc::factory(const std::string &directory,
                      ErasureCodeProfile &profile,
                      ErasureCodeInterfaceRef *erasure_code,
                      ostream *ss) {
@@ -42,7 +40,6 @@ public:
     }
     *erasure_code = ErasureCodeInterfaceRef(interface);
     return 0;
-  }
 };
 
 const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
diff --git a/src/erasure-code/lrc/ErasureCodePluginLrc.h b/src/erasure-code/lrc/ErasureCodePluginLrc.h
new file mode 100644 (file)
index 0000000..a0dbe74
--- /dev/null
@@ -0,0 +1,31 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph distributed storage system
+ *
+ * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
+ * Copyright (C) 2014 Red Hat <contact@redhat.com>
+ *
+ * Author: Loic Dachary <loic@dachary.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ * 
+ */
+
+#ifndef CEPH_ERASURE_CODE_PLUGIN_LRC_H
+#define CEPH_ERASURE_CODE_PLUGIN_LRC_H
+
+#include "erasure-code/ErasureCodePlugin.h"
+
+class ErasureCodePluginLrc : public ErasureCodePlugin {
+public:
+  virtual int factory(const std::string &directory,
+                     ErasureCodeProfile &profile,
+                     ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss);
+};
+
+#endif
index 7d242b4f7e01e806a6cd793e8c7cfcd27f1ecc7a..d31777e50d6309355ba63a2ed1692eb916d0036f 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "ceph_ver.h"
 #include "common/debug.h"
-#include "erasure-code/ErasureCodePlugin.h"
+#include "ErasureCodePluginShec.h"
 #include "ErasureCodeShecTableCache.h"
 #include "ErasureCodeShec.h"
 #include "jerasure_init.h"
@@ -34,11 +34,7 @@ static ostream& _prefix(std::ostream* _dout)
   return *_dout << "ErasureCodePluginShec: ";
 }
 
-class ErasureCodePluginShec : public ErasureCodePlugin {
-public:
-  ErasureCodeShecTableCache tcache;
-
-  virtual int factory(const std::string &directory,
+int ErasureCodePluginShec::factory(const std::string &directory,
                      ErasureCodeProfile &profile,
                      ErasureCodeInterfaceRef *erasure_code,
                      ostream *ss) {
@@ -68,8 +64,7 @@ public:
     dout(10) << "ErasureCodePluginShec: factory() completed" << dendl;
 
     return 0;
-  }
-};
+}
 
 const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
 
diff --git a/src/erasure-code/shec/ErasureCodePluginShec.h b/src/erasure-code/shec/ErasureCodePluginShec.h
new file mode 100644 (file)
index 0000000..fa64297
--- /dev/null
@@ -0,0 +1,34 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph distributed storage system
+ *
+ * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
+ * Copyright (C) 2014 Red Hat <contact@redhat.com>
+ *
+ * Author: Loic Dachary <loic@dachary.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ * 
+ */
+
+#ifndef CEPH_ERASURE_CODE_PLUGIN_SHEC_H
+#define CEPH_ERASURE_CODE_PLUGIN_SHEC_H
+
+#include "ErasureCodeShecTableCache.h"
+#include "erasure-code/ErasureCodePlugin.h"
+
+class ErasureCodePluginShec : public ErasureCodePlugin {
+public:
+  ErasureCodeShecTableCache tcache;
+
+  virtual int factory(const std::string &directory,
+                     ErasureCodeProfile &profile,
+                     ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss);
+};
+
+#endif