]> git.proxmox.com Git - ceph.git/blame - ceph/src/kv/KeyValueDB.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / kv / KeyValueDB.cc
CommitLineData
7c673cae
FG
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"
7c673cae 5#include "MemDB.h"
7c673cae 6#include "RocksDBStore.h"
f67539c2
TL
7
8using std::map;
9using std::string;
7c673cae
FG
10
11KeyValueDB *KeyValueDB::create(CephContext *cct, const string& type,
12 const string& dir,
11fdf7f2 13 map<string,string> options,
7c673cae
FG
14 void *p)
15{
7c673cae 16 if (type == "rocksdb") {
11fdf7f2 17 return new RocksDBStore(cct, dir, options, p);
7c673cae 18 }
7c673cae
FG
19 if ((type == "memdb") &&
20 cct->check_experimental_feature_enabled("memdb")) {
21 return new MemDB(cct, dir, p);
22 }
23 return NULL;
24}
25
26int KeyValueDB::test_init(const string& type, const string& dir)
27{
7c673cae
FG
28 if (type == "rocksdb") {
29 return RocksDBStore::_test_init(dir);
30 }
7c673cae
FG
31 if (type == "memdb") {
32 return MemDB::_test_init(dir);
33 }
34 return -EINVAL;
35}