JournalDB -> Box<JournalDB>, and it's a trait.

This commit is contained in:
Gav Wood
2016-03-11 12:54:48 +01:00
parent 99e577ad2f
commit 756f964130
7 changed files with 116 additions and 89 deletions

View File

@@ -250,9 +250,9 @@ pub fn generate_dummy_empty_blockchain() -> GuardedTempResult<BlockChain> {
}
}
pub fn get_temp_journal_db() -> GuardedTempResult<JournalDB> {
pub fn get_temp_journal_db() -> GuardedTempResult<Box<JournalDB + Send>> {
let temp = RandomTempPath::new();
let journal_db = JournalDB::new(temp.as_str());
let journal_db = Box::new(OptionOneDB::new(temp.as_str()));
GuardedTempResult {
_temp: temp,
result: Some(journal_db)
@@ -268,8 +268,8 @@ pub fn get_temp_state() -> GuardedTempResult<State> {
}
}
pub fn get_temp_journal_db_in(path: &Path) -> JournalDB {
JournalDB::new(path.to_str().unwrap())
pub fn get_temp_journal_db_in(path: &Path) -> Box<JournalDB + Send> {
Box::new(OptionOneDB::new(path.to_str().unwrap()))
}
pub fn get_temp_state_in(path: &Path) -> State {