Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions file_store/src/cli/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use crate::{
iot_packet::IotValidPacket,
mobile_radio_invalidated_threshold::VerifiedInvalidatedRadioThresholdIngestReport,
mobile_radio_threshold::VerifiedRadioThresholdIngestReport,
mobile_session::{DataTransferSessionIngestReport, InvalidDataTransferIngestReport},
mobile_session::{
DataTransferSessionIngestReport, InvalidDataTransferIngestReport,
VerifiedDataTransferIngestReport,
},
mobile_subscriber::{SubscriberLocationIngestReport, VerifiedSubscriberLocationIngestReport},
reward_manifest::RewardManifest,
speedtest::{CellSpeedtest, CellSpeedtestIngestReport},
Expand All @@ -32,8 +35,8 @@ use helium_proto::{
HexUsageStatsIngestReportV1, InvalidDataTransferIngestReportV1, MobileRewardShare,
OracleBoostingReportV1, RadioRewardShare, RadioUsageStatsIngestReportV1, SpeedtestAvg,
SpeedtestIngestReportV1, SpeedtestReqV1, UniqueConnectionsIngestReportV1,
VerifiedInvalidatedRadioThresholdIngestReportV1, VerifiedRadioThresholdIngestReportV1,
VerifiedUniqueConnectionsIngestReportV1,
VerifiedDataTransferIngestReportV1, VerifiedInvalidatedRadioThresholdIngestReportV1,
VerifiedRadioThresholdIngestReportV1, VerifiedUniqueConnectionsIngestReportV1,
},
router::PacketRouterPacketReportV1,
},
Expand Down Expand Up @@ -162,6 +165,27 @@ impl Cmd {
"last_timestamp": msg.last_timestamp,
}))?;
}
FileType::VerifiedDataTransferSession => {
let report: VerifiedDataTransferIngestReport =
VerifiedDataTransferIngestReportV1::decode(msg)?.try_into()?;
let report = report.report;
let req = report.report;
let data_transfer_usage = json!({
"pub_key": PublicKey::try_from(req.data_transfer_usage.pub_key)?,
"upload_bytes": req.data_transfer_usage.upload_bytes,
"download_bytes": req.data_transfer_usage.download_bytes,
"radio_access_technology": req.data_transfer_usage.radio_access_technology,
"event_id": req.data_transfer_usage.event_id,
"payer": req.data_transfer_usage.payer,
"timestamp": req.data_transfer_usage.timestamp,
});
print_json(&json!({
"rewardable_bytes": req.rewardable_bytes,
"pub_key": PublicKey::try_from(req.pub_key)?,
"received_timestamp": report.received_timestamp,
"data_transfer_usage": data_transfer_usage,
}))?;
}
FileType::IotBeaconIngestReport => {
let dec_msg = LoraBeaconIngestReportV1::decode(msg)?;
let json = json!({
Expand Down
1 change: 1 addition & 0 deletions file_store/src/file_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ impl FromStr for FileType {
}
MOBILE_BAN_REPORT => Self::MobileBanReport,
VERIFIED_MOBILE_BAN_REPORT => Self::VerifiedMobileBanReport,
VERIFIED_DATA_TRANSFER_SESSION => Self::VerifiedDataTransferSession,
_ => return Err(Error::from(io::Error::from(io::ErrorKind::InvalidInput))),
};
Ok(result)
Expand Down
20 changes: 20 additions & 0 deletions file_store/src/mobile_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,26 @@ impl MsgTimestamp<u64> for VerifiedDataTransferIngestReport {
}
}

impl MsgTimestamp<Result<DateTime<Utc>>> for VerifiedDataTransferIngestReportV1 {
fn timestamp(&self) -> Result<DateTime<Utc>> {
self.timestamp.to_timestamp_millis()
}
}

impl TryFrom<VerifiedDataTransferIngestReportV1> for VerifiedDataTransferIngestReport {
type Error = Error;
fn try_from(v: VerifiedDataTransferIngestReportV1) -> Result<Self> {
Ok(Self {
status: v.status(),
timestamp: v.timestamp()?,
report: v
.report
.ok_or_else(|| Error::not_found("data transfer session ingest report"))?
.try_into()?,
})
}
}

impl From<VerifiedDataTransferIngestReport> for VerifiedDataTransferIngestReportV1 {
fn from(v: VerifiedDataTransferIngestReport) -> Self {
let timestamp = v.timestamp();
Expand Down