Fix warnings: dyn

This commit is contained in:
adria0
2020-07-29 10:36:15 +02:00
committed by Artem Vorotnikov
parent 4adb44155d
commit 1700873f48
198 changed files with 1180 additions and 1072 deletions

View File

@@ -37,13 +37,13 @@ mod migration;
pub use self::migration::migrate;
struct AppDB {
key_value: Arc<KeyValueDB>,
key_value: Arc<dyn KeyValueDB>,
blooms: blooms_db::Database,
trace_blooms: blooms_db::Database,
}
impl BlockChainDB for AppDB {
fn key_value(&self) -> &Arc<KeyValueDB> {
fn key_value(&self) -> &Arc<dyn KeyValueDB> {
&self.key_value
}
@@ -58,7 +58,7 @@ impl BlockChainDB for AppDB {
/// Open a secret store DB using the given secret store data path. The DB path is one level beneath the data path.
#[cfg(feature = "secretstore")]
pub fn open_secretstore_db(data_path: &str) -> Result<Arc<KeyValueDB>, String> {
pub fn open_secretstore_db(data_path: &str) -> Result<Arc<dyn KeyValueDB>, String> {
use std::path::PathBuf;
let mut db_path = PathBuf::from(data_path);
@@ -75,7 +75,7 @@ pub fn open_secretstore_db(data_path: &str) -> Result<Arc<KeyValueDB>, String> {
pub fn restoration_db_handler(
client_path: &Path,
client_config: &ClientConfig,
) -> Box<BlockChainDBHandler> {
) -> Box<dyn BlockChainDBHandler> {
let client_db_config = helpers::client_db_config(client_path, client_config);
struct RestorationDBHandler {
@@ -83,7 +83,7 @@ pub fn restoration_db_handler(
}
impl BlockChainDBHandler for RestorationDBHandler {
fn open(&self, db_path: &Path) -> io::Result<Arc<BlockChainDB>> {
fn open(&self, db_path: &Path) -> io::Result<Arc<dyn BlockChainDB>> {
open_database(&db_path.to_string_lossy(), &self.config)
}
}
@@ -98,7 +98,7 @@ pub fn open_db(
client_path: &str,
cache_config: &CacheConfig,
compaction: &DatabaseCompactionProfile,
) -> io::Result<Arc<BlockChainDB>> {
) -> io::Result<Arc<dyn BlockChainDB>> {
let path = Path::new(client_path);
let db_config = DatabaseConfig {
@@ -110,7 +110,10 @@ pub fn open_db(
open_database(client_path, &db_config)
}
pub fn open_database(client_path: &str, config: &DatabaseConfig) -> io::Result<Arc<BlockChainDB>> {
pub fn open_database(
client_path: &str,
config: &DatabaseConfig,
) -> io::Result<Arc<dyn BlockChainDB>> {
let path = Path::new(client_path);
let blooms_path = path.join("blooms");