pub fn prepare_storage(setting: &Settings, logger: &Logger) -> Result<NodeStorage, Error> {
    match &setting.storage {
        None => {
            info!(logger, "storing blockchain in memory");
            Ok(Box::new(MemoryBlockStore::new()))
        }
        Some(dir) => {
            std::fs::create_dir_all(dir).map_err(|err| Error::IO {
                source: err,
                reason: ErrorKind::SQLite,
            })?;
            let mut sqlite = dir.clone();
            sqlite.push("blocks.sqlite");
            info!(logger, "storing blockchain in '{:?}'", sqlite);
            Ok(Box::new(SQLiteBlockStore::new(sqlite)))
        }
    }
}
/// prepare the block storage from the given settings
///
prepare the block storage from the given settings
prepare the block storage from the given settings
pub fn prepare_storage(setting: &Settings, logger: &Logger) -> Result<NodeStorage, Error> {
    match &setting.storage {
        None => {
            info!(logger, "storing blockchain in memory");
            Ok(Box::new(MemoryBlockStore::new()))
        }
        Some(dir) => {
            std::fs::create_dir_all(dir).map_err(|err| Error::IO {
                source: err,
                reason: ErrorKind::SQLite,
            })?;
            let mut sqlite = dir.clone();
            sqlite.push("blocks.sqlite");
            info!(logger, "storing blockchain in '{:?}'", sqlite);
            Ok(Box::new(SQLiteBlockStore::new(sqlite)))
        }
    }
}
pub fn prepare_storage ( setting : & Settings , logger : & Logger ) -> Result < NodeStorage , Error > { match & setting . storage { None => { info ! ( logger " " ) ; Ok ( Box :: new ( MemoryBlockStore :: new ( ) ) ) } Some ( dir ) => { std :: fs :: create_dir_all ( dir ) . map_err ( | err | Error :: IO { source : err , reason : ErrorKind :: SQLite , } ) ? ; let mut sqlite = dir . clone ( ) ; sqlite . push ( " " ) ; info ! ( logger " " sqlite ) ; Ok ( Box :: new ( SQLiteBlockStore :: new ( sqlite ) ) ) } } }
prepare the block storage from the given settings
prepare the block storage from the given settings
setting
&Settings
logger
&Logger
setting
&Settings
logger
&Logger