Decouple rocksdb dependency from ethcore (#8320)

* Move client DB opening logic to CLI

* Move restoration db open logic to CLI

This adds KeyValueDBHandler which handles opening a new database, thus allow us to move the restoration db open logic
out of ethcore.

* Move rocksdb's compactionprofile conversion to CLI

* Move kvdb_rocksdb as test dependency for ethcore

* Fix tests due to interface change

* Fix service tests

* Remove unused migration dep for ethcore
This commit is contained in:
Wei Tang
2018-04-09 20:21:37 +08:00
committed by Rando
parent 9436e88d27
commit c039ab79b5
16 changed files with 176 additions and 76 deletions

View File

@@ -15,13 +15,11 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::str::FromStr;
use std::path::Path;
use std::fmt::{Display, Formatter, Error as FmtError};
use mode::Mode as IpcMode;
use verification::{VerifierType, QueueConfig};
use journaldb;
use kvdb_rocksdb::CompactionProfile;
pub use std::time::Duration;
pub use blockchain::Config as BlockChainConfig;
@@ -45,17 +43,6 @@ impl Default for DatabaseCompactionProfile {
}
}
impl DatabaseCompactionProfile {
/// Returns corresponding compaction profile.
pub fn compaction_profile(&self, db_path: &Path) -> CompactionProfile {
match *self {
DatabaseCompactionProfile::Auto => CompactionProfile::auto(db_path),
DatabaseCompactionProfile::SSD => CompactionProfile::ssd(),
DatabaseCompactionProfile::HDD => CompactionProfile::hdd(),
}
}
}
impl FromStr for DatabaseCompactionProfile {
type Err = String;