mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-03 09:47:38 +00:00
15 lines
378 B
Rust
15 lines
378 B
Rust
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
|
|
}
|