lighthouse-pulse/lighthouse/db/mod.rs

15 lines
378 B
Rust
Raw Normal View History

2018-08-16 04:17:28 +00:00
extern crate rocksdb;
use std::fs;
use std::path::Path;
pub use self::rocksdb::DB;
pub fn open_db(path: &Path) -> DB {
let db_path = path.join("rocksdb");
fs::create_dir_all(&db_path)
.expect(&format!("Unable to create {:?}", &db_path));
let db = DB::open_default(db_path.join("lighthouse.rdb"))
.expect("Unable to open local database.");
db
}