blob: 30e7e671114473ae206e7a86a7ab607a7fcb4d26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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;
}
|