Generic way to create an ObjectStore implementation of the required type,
so that users don't need to know anything about it.
Signed-off-by: Sage Weil <sage@inktank.com>
#include "common/Formatter.h"
#include "FileStore.h"
+ObjectStore *ObjectStore::create(const string& type,
+ const string& data,
+ const string& journal)
+{
+ if (type == "filestore") {
+ return new FileStore(data, journal);
+ }
+ return NULL;
+}
+
ostream& operator<<(ostream& out, const ObjectStore::Sequencer& s)
{
return out << "osr(" << s.get_name() << " " << &s << ")";
class ObjectStore {
public:
+ /**
+ * create - create an ObjectStore instance
+ *
+ * @param type type of store
+ * @param data path (or other descriptor) for data
+ * @param journal path (or other descriptor) for journal (optional)
+ */
+ static ObjectStore *create(const string& type,
+ const string& data,
+ const string& journal);
Logger *logger;
virtual void inject_data_error(const ghobject_t &oid) {}
virtual void inject_mdata_error(const ghobject_t &oid) {}
};
-
-
WRITE_CLASS_ENCODER(ObjectStore::Transaction)
ostream& operator<<(ostream& out, const ObjectStore::Sequencer& s);