|
|
@ -5,14 +5,14 @@ use std::path::{PathBuf, Path}; |
|
|
|
|
|
|
|
|
|
|
|
use rocksdb::{DB, Options}; |
|
|
|
use rocksdb::{DB, Options}; |
|
|
|
|
|
|
|
|
|
|
|
// Ensures that DB::Destroy is called for this database when DBPath is dropped.
|
|
|
|
/// Ensures that DB::Destroy is called for this database when DBPath is dropped.
|
|
|
|
pub struct DBPath { |
|
|
|
pub struct DBPath { |
|
|
|
path: PathBuf |
|
|
|
path: PathBuf |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl DBPath { |
|
|
|
impl DBPath { |
|
|
|
// Suffixes the given `prefix` with a timestamp to ensure that subsequent test runs don't reuse
|
|
|
|
/// Suffixes the given `prefix` with a timestamp to ensure that subsequent test runs don't reuse
|
|
|
|
// an old database in case of panics prior to Drop being called.
|
|
|
|
/// an old database in case of panics prior to Drop being called.
|
|
|
|
pub fn new(prefix: &str) -> DBPath { |
|
|
|
pub fn new(prefix: &str) -> DBPath { |
|
|
|
let current_time = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); |
|
|
|
let current_time = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); |
|
|
|
let path = format!( |
|
|
|
let path = format!( |
|
|
|