From 4f21e29b917cc0e54da2cfd6b6032abffd15467c Mon Sep 17 00:00:00 2001 From: Michael Jeffrey Date: Tue, 17 Dec 2024 10:06:52 -0700 Subject: [PATCH] Remove need for settings file to dump file (#919) --- file_store/src/cli/dump.rs | 5 +++-- file_store/src/main.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/file_store/src/cli/dump.rs b/file_store/src/cli/dump.rs index 59ca53cc0..652969307 100644 --- a/file_store/src/cli/dump.rs +++ b/file_store/src/cli/dump.rs @@ -13,7 +13,7 @@ use crate::{ unique_connections::UniqueConnectionReq, usage_counts::{HexUsageCountsIngestReport, RadioUsageCountsIngestReport}, wifi_heartbeat::WifiHeartbeatIngestReport, - FileType, Result, Settings, + FileType, Result, }; use base64::Engine; use csv::Writer; @@ -54,7 +54,7 @@ pub struct Cmd { } impl Cmd { - pub async fn run(&self, _settings: &Settings) -> Result { + pub async fn run(&self) -> Result { let mut file_stream = file_source::source([&self.in_path]); let mut wtr = Writer::from_writer(io::stdout()); @@ -301,6 +301,7 @@ impl Cmd { "written_files": manifest.written_files, "start_timestamp": manifest.start_timestamp, "end_timestamp": manifest.end_timestamp, + "reward_data": manifest.reward_data.unwrap() }))?; } FileType::SignedPocReceiptTxn => { diff --git a/file_store/src/main.rs b/file_store/src/main.rs index 0f56edce2..4acf0b49e 100644 --- a/file_store/src/main.rs +++ b/file_store/src/main.rs @@ -19,7 +19,7 @@ pub struct Cli { impl Cli { pub async fn run(self) -> Result { - let settings = Settings::new(&self.config)?; + let settings = Settings::new(&self.config); self.cmd.run(settings).await } } @@ -33,12 +33,12 @@ pub enum Cmd { } impl Cmd { - pub async fn run(&self, settings: Settings) -> Result { + pub async fn run(&self, settings: Result) -> Result { match self { - Cmd::Info(cmd) => cmd.run(&settings).await, - Cmd::Dump(cmd) => cmd.run(&settings).await, - Cmd::Bucket(cmd) => cmd.run(&settings).await, - Cmd::DumpMobileRewards(cmd) => cmd.run(&settings).await, + Cmd::Info(cmd) => cmd.run(&settings?).await, + Cmd::Dump(cmd) => cmd.run().await, + Cmd::Bucket(cmd) => cmd.run(&settings?).await, + Cmd::DumpMobileRewards(cmd) => cmd.run(&settings?).await, } } }