summaryrefslogtreecommitdiffstats
path: root/src/kv/KeyValueDB.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/kv/KeyValueDB.cc
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/kv/KeyValueDB.cc')
-rw-r--r--src/kv/KeyValueDB.cc67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/kv/KeyValueDB.cc b/src/kv/KeyValueDB.cc
new file mode 100644
index 00000000..30e7e671
--- /dev/null
+++ b/src/kv/KeyValueDB.cc
@@ -0,0 +1,67 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "KeyValueDB.h"
+#ifdef WITH_LEVELDB
+#include "LevelDBStore.h"
+#endif
+#include "MemDB.h"
+#ifdef HAVE_LIBROCKSDB
+#include "RocksDBStore.h"
+#endif
+#ifdef HAVE_KINETIC
+#include "KineticStore.h"
+#endif
+
+KeyValueDB *KeyValueDB::create(CephContext *cct, const string& type,
+ const string& dir,
+ map<string,string> options,
+ void *p)
+{
+#ifdef WITH_LEVELDB
+ if (type == "leveldb") {
+ return new LevelDBStore(cct, dir);
+ }
+#endif
+#ifdef HAVE_KINETIC
+ if (type == "kinetic" &&
+ cct->check_experimental_feature_enabled("kinetic")) {
+ return new KineticStore(cct);
+ }
+#endif
+#ifdef HAVE_LIBROCKSDB
+ if (type == "rocksdb") {
+ return new RocksDBStore(cct, dir, options, p);
+ }
+#endif
+
+ if ((type == "memdb") &&
+ cct->check_experimental_feature_enabled("memdb")) {
+ return new MemDB(cct, dir, p);
+ }
+ return NULL;
+}
+
+int KeyValueDB::test_init(const string& type, const string& dir)
+{
+#ifdef WITH_LEVELDB
+ if (type == "leveldb") {
+ return LevelDBStore::_test_init(dir);
+ }
+#endif
+#ifdef HAVE_KINETIC
+ if (type == "kinetic") {
+ return KineticStore::_test_init(g_ceph_context);
+ }
+#endif
+#ifdef HAVE_LIBROCKSDB
+ if (type == "rocksdb") {
+ return RocksDBStore::_test_init(dir);
+ }
+#endif
+
+ if (type == "memdb") {
+ return MemDB::_test_init(dir);
+ }
+ return -EINVAL;
+}