mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
New database trait (#5549)
* Introduce trait * The trait * Generic * Basic impls. * Remove unneeded bounds * Minor changes * Switch over to the new DB trait * Integrated parity-db and added CLI for db selection * Default impl. * Fix logs. * Started integrating subdb * Apply suggestions from code review Co-Authored-By: Cecile Tonglet <cecile@parity.io> * Apply suggestions from code review Co-Authored-By: Nikolay Volf <nikvolf@gmail.com> * Enable subdb * Bump parity-db * Fixed CLI macro * Fixed browser build * Fixed features * Sort out features * Use parity-db from crates.io * Typo Co-authored-by: arkpar <arkady.paronyan@gmail.com> Co-authored-by: Cecile Tonglet <cecile@parity.io> Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
use crate::{Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL_ID, MallocSizeOfWasm};
|
||||
use crate::{TaskManagerBuilder, start_rpc_servers, build_network_future, TransactionPoolAdapter};
|
||||
use crate::status_sinks;
|
||||
use crate::config::{Configuration, DatabaseConfig, KeystoreConfig, PrometheusConfig};
|
||||
use crate::config::{Configuration, KeystoreConfig, PrometheusConfig};
|
||||
use crate::metrics::MetricsService;
|
||||
use sc_client_api::{
|
||||
self,
|
||||
@@ -196,15 +196,7 @@ fn new_full_parts<TBl, TRtApi, TExecDisp>(
|
||||
state_cache_child_ratio:
|
||||
config.state_cache_child_ratio.map(|v| (v, 100)),
|
||||
pruning: config.pruning.clone(),
|
||||
source: match &config.database {
|
||||
DatabaseConfig::Path { path, cache_size } =>
|
||||
sc_client_db::DatabaseSettingsSrc::Path {
|
||||
path: path.clone(),
|
||||
cache_size: *cache_size,
|
||||
},
|
||||
DatabaseConfig::Custom(db) =>
|
||||
sc_client_db::DatabaseSettingsSrc::Custom(db.clone()),
|
||||
},
|
||||
source: config.database.clone(),
|
||||
};
|
||||
|
||||
let extensions = sc_client_api::execution_extensions::ExecutionExtensions::new(
|
||||
@@ -308,15 +300,7 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> {
|
||||
state_cache_child_ratio:
|
||||
config.state_cache_child_ratio.map(|v| (v, 100)),
|
||||
pruning: config.pruning.clone(),
|
||||
source: match &config.database {
|
||||
DatabaseConfig::Path { path, cache_size } =>
|
||||
sc_client_db::DatabaseSettingsSrc::Path {
|
||||
path: path.clone(),
|
||||
cache_size: *cache_size,
|
||||
},
|
||||
DatabaseConfig::Custom(db) =>
|
||||
sc_client_db::DatabaseSettingsSrc::Custom(db.clone()),
|
||||
},
|
||||
source: config.database.clone(),
|
||||
};
|
||||
sc_client_db::light::LightStorage::new(db_settings)?
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Service configuration.
|
||||
|
||||
pub use sc_client::ExecutionStrategies;
|
||||
pub use sc_client_db::{kvdb::KeyValueDB, PruningMode};
|
||||
pub use sc_client_db::{Database, PruningMode, DatabaseSettingsSrc as DatabaseConfig};
|
||||
pub use sc_network::Multiaddr;
|
||||
pub use sc_network::config::{ExtTransport, MultiaddrWithPeerId, NetworkConfiguration, Role, NodeKeyConfig};
|
||||
pub use sc_executor::WasmExecutionMethod;
|
||||
@@ -124,21 +124,6 @@ impl KeystoreConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Configuration of the database of the client.
|
||||
#[derive(Clone)]
|
||||
pub enum DatabaseConfig {
|
||||
/// Database file at a specific path. Recommended for most uses.
|
||||
Path {
|
||||
/// Path to the database.
|
||||
path: PathBuf,
|
||||
/// Cache Size for internal database in MiB
|
||||
cache_size: usize,
|
||||
},
|
||||
|
||||
/// A custom implementation of an already-open database.
|
||||
Custom(Arc<dyn KeyValueDB>),
|
||||
}
|
||||
|
||||
/// Configuration of the Prometheus endpoint.
|
||||
#[derive(Clone)]
|
||||
pub struct PrometheusConfig {
|
||||
|
||||
Reference in New Issue
Block a user