]> git.proxmox.com Git - ceph.git/blob - ceph/src/kv/KeyValueDB.cc
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / kv / KeyValueDB.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #include "KeyValueDB.h"
5 #ifdef WITH_LEVELDB
6 #include "LevelDBStore.h"
7 #endif
8 #include "MemDB.h"
9 #ifdef HAVE_LIBROCKSDB
10 #include "RocksDBStore.h"
11 #endif
12 #ifdef HAVE_KINETIC
13 #include "KineticStore.h"
14 #endif
15
16 KeyValueDB *KeyValueDB::create(CephContext *cct, const string& type,
17 const string& dir,
18 void *p)
19 {
20 #ifdef WITH_LEVELDB
21 if (type == "leveldb") {
22 return new LevelDBStore(cct, dir);
23 }
24 #endif
25 #ifdef HAVE_KINETIC
26 if (type == "kinetic" &&
27 cct->check_experimental_feature_enabled("kinetic")) {
28 return new KineticStore(cct);
29 }
30 #endif
31 #ifdef HAVE_LIBROCKSDB
32 if (type == "rocksdb") {
33 return new RocksDBStore(cct, dir, p);
34 }
35 #endif
36
37 if ((type == "memdb") &&
38 cct->check_experimental_feature_enabled("memdb")) {
39 return new MemDB(cct, dir, p);
40 }
41 return NULL;
42 }
43
44 int KeyValueDB::test_init(const string& type, const string& dir)
45 {
46 #ifdef WITH_LEVELDB
47 if (type == "leveldb") {
48 return LevelDBStore::_test_init(dir);
49 }
50 #endif
51 #ifdef HAVE_KINETIC
52 if (type == "kinetic") {
53 return KineticStore::_test_init(g_ceph_context);
54 }
55 #endif
56 #ifdef HAVE_LIBROCKSDB
57 if (type == "rocksdb") {
58 return RocksDBStore::_test_init(dir);
59 }
60 #endif
61
62 if (type == "memdb") {
63 return MemDB::_test_init(dir);
64 }
65 return -EINVAL;
66 }