Remove the Store dependency from the Runtime object

This commit is contained in:
Matthias Beyer 2016-01-09 23:23:09 +01:00
parent cfa62e85ef
commit 8c8a88077f
1 changed files with 2 additions and 14 deletions

View File

@ -7,8 +7,6 @@ use log::{LogRecord, LogLevel, LogLevelFilter, LogMetadata, SetLoggerError};
pub use cli::CliConfig; pub use cli::CliConfig;
pub use configuration::Configuration as Cfg; pub use configuration::Configuration as Cfg;
use storage::Store;
pub struct ImagLogger { pub struct ImagLogger {
lvl: LogLevel, lvl: LogLevel,
} }
@ -32,7 +30,7 @@ impl ImagLogger {
log::set_logger(|max_log_lvl| { log::set_logger(|max_log_lvl| {
max_log_lvl.set(lvl); max_log_lvl.set(lvl);
debug!("Init logger with: {}", lvl); // debug!("Init logger with: {}", lvl);
Box::new(ImagLogger::new(lvl.to_log_level().unwrap())) Box::new(ImagLogger::new(lvl.to_log_level().unwrap()))
}) })
} }
@ -54,13 +52,11 @@ impl log::Log for ImagLogger {
/** /**
* Runtime object, represents a single interface to both the CLI configuration and the * Runtime object, represents a single interface to both the CLI configuration and the
* configuration file. Also carries the store object around and is basically an object which * configuration file.
* contains everything which is required to run a command/module.
*/ */
pub struct Runtime<'a> { pub struct Runtime<'a> {
pub config : CliConfig<'a>, pub config : CliConfig<'a>,
pub configuration : Cfg, pub configuration : Cfg,
pub store : Store,
} }
impl<'a> Runtime<'a> { impl<'a> Runtime<'a> {
@ -70,7 +66,6 @@ impl<'a> Runtime<'a> {
Runtime { Runtime {
config: config, config: config,
configuration: cfg, configuration: cfg,
store: Store::new(sp),
} }
} }
@ -95,13 +90,6 @@ impl<'a> Runtime<'a> {
self.config.store_path().unwrap_or(self.configuration.store_path()) self.config.store_path().unwrap_or(self.configuration.store_path())
} }
/**
* Get the store object
*/
pub fn store(&self) -> &Store {
&self.store
}
/** /**
* Get the runtime path we are currently using * Get the runtime path we are currently using
*/ */