]> git.proxmox.com Git - ceph.git/blob - ceph/src/kv/KeyValueDB.cc
update sources to ceph Nautilus 14.2.1
[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 map<string,string> options,
19 void *p)
20 {
21 #ifdef WITH_LEVELDB
22 if (type == "leveldb") {
23 return new LevelDBStore(cct, dir);
24 }
25 #endif
26 #ifdef HAVE_KINETIC
27 if (type == "kinetic" &&
28 cct->check_experimental_feature_enabled("kinetic")) {
29 return new KineticStore(cct);
30 }
31 #endif
32 #ifdef HAVE_LIBROCKSDB
33 if (type == "rocksdb") {
34 return new RocksDBStore(cct, dir, options, p);
35 }
36 #endif
37
38 if ((type == "memdb") &&
39 cct->check_experimental_feature_enabled("memdb")) {
40 return new MemDB(cct, dir, p);
41 }
42 return NULL;
43 }
44
45 int KeyValueDB::test_init(const string& type, const string& dir)
46 {
47 #ifdef WITH_LEVELDB
48 if (type == "leveldb") {
49 return LevelDBStore::_test_init(dir);
50 }
51 #endif
52 #ifdef HAVE_KINETIC
53 if (type == "kinetic") {
54 return KineticStore::_test_init(g_ceph_context);
55 }
56 #endif
57 #ifdef HAVE_LIBROCKSDB
58 if (type == "rocksdb") {
59 return RocksDBStore::_test_init(dir);
60 }
61 #endif
62
63 if (type == "memdb") {
64 return MemDB::_test_init(dir);
65 }
66 return -EINVAL;
67 }