MCPcopy Create free account
hub / github.com/ElementsProject/elements / Open

Method Open

src/leveldb/benchmarks/db_bench_tree_db.cc:386–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384
385 private:
386 void Open(bool sync) {
387 assert(db_ == nullptr);
388
389 // Initialize db_
390 db_ = new kyotocabinet::TreeDB();
391 char file_name[100];
392 db_num_++;
393 std::string test_dir;
394 Env::Default()->GetTestDirectory(&test_dir);
395 snprintf(file_name, sizeof(file_name), "%s/dbbench_polyDB-%d.kct",
396 test_dir.c_str(), db_num_);
397
398 // Create tuning options and open the database
399 int open_options =
400 kyotocabinet::PolyDB::OWRITER | kyotocabinet::PolyDB::OCREATE;
401 int tune_options =
402 kyotocabinet::TreeDB::TSMALL | kyotocabinet::TreeDB::TLINEAR;
403 if (FLAGS_compression) {
404 tune_options |= kyotocabinet::TreeDB::TCOMPRESS;
405 db_->tune_compressor(&comp_);
406 }
407 db_->tune_options(tune_options);
408 db_->tune_page_cache(FLAGS_cache_size);
409 db_->tune_page(FLAGS_page_size);
410 db_->tune_map(256LL << 20);
411 if (sync) {
412 open_options |= kyotocabinet::PolyDB::OAUTOSYNC;
413 }
414 if (!db_->open(file_name, open_options)) {
415 fprintf(stderr, "open error: %s\n", db_->error().name());
416 }
417 }
418
419 void Write(bool sync, Order order, DBState state, int num_entries,
420 int value_size, int entries_per_batch) {

Callers

nothing calls this directly

Calls 2

GetTestDirectoryMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected