Merge pull request #254 from influxdata/cn/further-improvement
refactor: Improve InputPath to InputReader conversionpull/24376/head
commit
c7380dbe79
|
@ -328,7 +328,10 @@ impl InputPath {
|
|||
Ok(Self { files })
|
||||
}
|
||||
|
||||
pub fn files(&self) -> &[PathBuf] {
|
||||
&self.files
|
||||
pub fn input_readers(&self) -> impl Iterator<Item = Result<InputReader>> + '_ {
|
||||
self.files
|
||||
.iter()
|
||||
.rev()
|
||||
.map(|p| InputReader::new(&p.to_string_lossy()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,12 +49,7 @@ pub async fn stats(config: &StatsConfig) -> Result<()> {
|
|||
|
||||
let mut builder = FileSetStatsBuilder::default();
|
||||
|
||||
for input_reader in input_path
|
||||
.files()
|
||||
.iter()
|
||||
.rev()
|
||||
.map(|p| InputReader::new(&p.to_string_lossy()))
|
||||
{
|
||||
for input_reader in input_path.input_readers() {
|
||||
let input_reader = input_reader.context(OpenInput)?;
|
||||
|
||||
let file_stats = stats_for_file(config, input_reader).await?;
|
||||
|
|
Loading…
Reference in New Issue