This will let us avoid passing options via global config options.
Signed-off-by: Sage Weil <sage@redhat.com>
KeyValueDB *KeyValueDB::create(CephContext *cct, const string& type,
const string& dir,
+ map<string,string> options,
void *p)
{
#ifdef WITH_LEVELDB
#endif
#ifdef HAVE_LIBROCKSDB
if (type == "rocksdb") {
- return new RocksDBStore(cct, dir, p);
+ return new RocksDBStore(cct, dir, options, p);
}
#endif
/// create a new instance
static KeyValueDB *create(CephContext *cct, const std::string& type,
const std::string& dir,
+ map<std::string,std::string> options = {},
void *p = NULL);
/// test whether we can successfully initialize; may have side effects (e.g., create)
CephContext *cct;
PerfCounters *logger;
string path;
+ map<string,string> kv_options;
void *priv;
rocksdb::DB *db;
rocksdb::Env *env;
compact_range_async(combine_strings(prefix, start), combine_strings(prefix, end));
}
- RocksDBStore(CephContext *c, const string &path, void *p) :
+ RocksDBStore(CephContext *c, const string &path, map<string,string> opt, void *p) :
cct(c),
logger(NULL),
path(path),
+ kv_options(opt),
priv(p),
db(NULL),
env(static_cast<rocksdb::Env*>(p)),
TEST(RocksDBOption, simple) {
rocksdb::Options options;
rocksdb::Status status;
- RocksDBStore *db = new RocksDBStore(g_ceph_context, dir, NULL);
+ map<string,string> kvoptions;
+ RocksDBStore *db = new RocksDBStore(g_ceph_context, dir, kvoptions, NULL);
string options_string = ""
"write_buffer_size=536870912;"
"create_if_missing=true;"
TEST(RocksDBOption, interpret) {
rocksdb::Options options;
rocksdb::Status status;
- RocksDBStore *db = new RocksDBStore(g_ceph_context, dir, NULL);
+ map<string,string> kvoptions;
+ RocksDBStore *db = new RocksDBStore(g_ceph_context, dir, kvoptions, NULL);
string options_string = "compact_on_mount = true; compaction_threads=10;flusher_threads=5;";
int r = db->ParseOptionsFromString(options_string, options);