summaryrefslogtreecommitdiff
path: root/src/osd/ErasureCodePlugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/ErasureCodePlugin.h')
-rw-r--r--src/osd/ErasureCodePlugin.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/osd/ErasureCodePlugin.h b/src/osd/ErasureCodePlugin.h
index 4c210d698d1..f1c1ccb31b3 100644
--- a/src/osd/ErasureCodePlugin.h
+++ b/src/osd/ErasureCodePlugin.h
@@ -17,6 +17,7 @@
#ifndef CEPH_ERASURE_CODE_PLUGIN_H
#define CEPH_ERASURE_CODE_PLUGIN_H
+#include "common/Mutex.h"
#include "ErasureCodeInterface.h"
extern "C" {
@@ -37,6 +38,32 @@ namespace ceph {
ErasureCodeInterfaceRef *erasure_code) = 0;
};
+ class ErasureCodePluginRegistry {
+ public:
+ Mutex lock;
+ std::map<std::string,ErasureCodePlugin*> plugins;
+
+ static ErasureCodePluginRegistry singleton;
+
+ ErasureCodePluginRegistry();
+ ~ErasureCodePluginRegistry();
+
+ static ErasureCodePluginRegistry &instance() {
+ return singleton;
+ }
+
+ int factory(const std::string &plugin,
+ const map<std::string,std::string> &parameters,
+ ErasureCodeInterfaceRef *erasure_code);
+
+ int add(const std::string &name, ErasureCodePlugin *plugin);
+ ErasureCodePlugin *get(const std::string &name);
+
+ int load(const std::string &plugin_name,
+ const map<std::string,std::string> &parameters,
+ ErasureCodePlugin **plugin);
+
+ };
}
#endif