diff --git a/file_store/src/cli/bucket.rs b/file_store/src/cli/bucket.rs index 8b4cca9bd..564a8a07e 100644 --- a/file_store/src/cli/bucket.rs +++ b/file_store/src/cli/bucket.rs @@ -3,6 +3,8 @@ use crate::{ iot_beacon_report::IotBeaconIngestReport, iot_valid_poc::IotPoc, iot_witness_report::IotWitnessIngestReport, + mobile_radio_invalidated_threshold::VerifiedInvalidatedRadioThresholdIngestReport, + mobile_radio_threshold::VerifiedRadioThresholdIngestReport, speedtest::{cli::SpeedtestAverage, CellSpeedtest}, traits::MsgDecode, Error, FileInfoStream, FileStore, FileType, Result, Settings, @@ -154,6 +156,7 @@ impl Get { fs::OpenOptions::new() .write(true) .create(true) + .truncate(true) .open(&self.dest.join(Path::new(&info.key))) .map_err(Error::from) .and_then(|mut file| { @@ -226,6 +229,15 @@ fn locate(prefix: &str, gateway: &PublicKey, buf: &[u8]) -> Result { IotWitnessIngestReport::decode(buf).and_then(|event| event.to_value_if(pub_key)) } + FileType::VerifiedRadioThresholdIngestReport => { + VerifiedRadioThresholdIngestReport::decode(buf) + .and_then(|event| event.to_value_if(pub_key)) + } + FileType::VerifiedInvalidatedRadioThresholdIngestReport => { + VerifiedInvalidatedRadioThresholdIngestReport::decode(buf) + .and_then(|event| event.to_value_if(pub_key)) + } + FileType::IotPoc => IotPoc::decode(buf).and_then(|event| event.to_value_if(pub_key)), _ => Ok(None), } @@ -305,3 +317,15 @@ impl Gateway for SpeedtestAverage { self.pub_key.as_ref() == pub_key } } + +impl Gateway for VerifiedRadioThresholdIngestReport { + fn has_pubkey(&self, pub_key: &[u8]) -> bool { + self.report.report.hotspot_pubkey.as_ref() == pub_key + } +} + +impl Gateway for VerifiedInvalidatedRadioThresholdIngestReport { + fn has_pubkey(&self, pub_key: &[u8]) -> bool { + self.report.report.hotspot_pubkey.as_ref() == pub_key + } +} diff --git a/file_store/src/cli/dump.rs b/file_store/src/cli/dump.rs index 2ebc05755..541a9774f 100644 --- a/file_store/src/cli/dump.rs +++ b/file_store/src/cli/dump.rs @@ -3,6 +3,8 @@ use crate::{ file_source, heartbeat::{CbrsHeartbeat, CbrsHeartbeatIngestReport}, iot_packet::IotValidPacket, + mobile_radio_invalidated_threshold::VerifiedInvalidatedRadioThresholdIngestReport, + mobile_radio_threshold::VerifiedRadioThresholdIngestReport, mobile_session::{DataTransferSessionIngestReport, InvalidDataTransferIngestReport}, mobile_subscriber::{SubscriberLocationIngestReport, VerifiedSubscriberLocationIngestReport}, speedtest::{CellSpeedtest, CellSpeedtestIngestReport}, @@ -25,6 +27,7 @@ use helium_proto::{ mobile_reward_share::Reward, CellHeartbeatIngestReportV1, CellHeartbeatReqV1, Heartbeat, InvalidDataTransferIngestReportV1, MobileRewardShare, RadioRewardShare, SpeedtestAvg, SpeedtestIngestReportV1, SpeedtestReqV1, + VerifiedInvalidatedRadioThresholdIngestReportV1, VerifiedRadioThresholdIngestReportV1, }, router::PacketRouterPacketReportV1, }, @@ -52,6 +55,16 @@ impl Cmd { while let Some(result) = file_stream.next().await { let msg = result?; match self.file_type { + FileType::VerifiedRadioThresholdIngestReport => { + let dec_msg = VerifiedRadioThresholdIngestReportV1::decode(msg)?; + let report = VerifiedRadioThresholdIngestReport::try_from(dec_msg)?; + print_json(&report)?; + } + FileType::VerifiedInvalidatedRadioThresholdIngestReport => { + let dec_msg = VerifiedInvalidatedRadioThresholdIngestReportV1::decode(msg)?; + let report = VerifiedInvalidatedRadioThresholdIngestReport::try_from(dec_msg)?; + print_json(&report)?; + } FileType::BoostedHexUpdate => { let dec_msg = BoostedHexUpdateProto::decode(msg)?; let update = dec_msg.update.unwrap(); diff --git a/file_store/src/file_sink.rs b/file_store/src/file_sink.rs index 54ed6ee71..d10dd93ed 100644 --- a/file_store/src/file_sink.rs +++ b/file_store/src/file_sink.rs @@ -432,6 +432,7 @@ impl FileSink { OpenOptions::new() .write(true) .create(true) + .truncate(true) .open(&new_path) .await?, ));