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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ aws-config = "0.51"
aws-sdk-s3 = "0.21"
aws-types = { version = "0.51", features = ["hardcoded-credentials"]}
tempfile = "3"
csv = "*"

[patch.crates-io]
anchor-lang = { git = "https://github.com/madninja/anchor.git", branch = "madninja/const_pubkey" }
Expand Down
2 changes: 1 addition & 1 deletion file_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tracing = { workspace = true }
chrono = { workspace = true }
helium-proto = { workspace = true }
helium-crypto = { workspace = true }
csv = "*"
csv = { workspace = true }
http = { workspace = true }
aws-config = { workspace = true }
aws-sdk-s3 = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions mobile_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ tower-http = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
triggered = { workspace = true }
csv = { workspace = true }

coverage-map = { path = "../coverage_map" }
custom-tracing = { path = "../custom_tracing", features = ["grpc"] }
Expand Down
3 changes: 3 additions & 0 deletions mobile_config/migrations/8_mob_rad_track_add_location.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE mobile_radio_tracker
ADD COLUMN asserted_location BIGINT,
ADD COLUMN asserted_location_changed_at TIMESTAMPTZ;
39 changes: 28 additions & 11 deletions mobile_config/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ use helium_proto::services::{
sub_dao::SubDaoServer,
};
use mobile_config::{
admin_service::AdminService, authorization_service::AuthorizationService,
carrier_service::CarrierService, entity_service::EntityService,
gateway_service::GatewayService, hex_boosting_service::HexBoostingService, key_cache::KeyCache,
mobile_radio_tracker::MobileRadioTracker, settings::Settings, sub_dao_service::SubDaoService,
admin_service::AdminService,
authorization_service::AuthorizationService,
carrier_service::CarrierService,
entity_service::EntityService,
gateway_service::GatewayService,
hex_boosting_service::HexBoostingService,
key_cache::KeyCache,
mobile_radio_tracker::{migrate_mobile_tracker_locations, MobileRadioTracker},
settings::Settings,
sub_dao_service::SubDaoService,
};
use std::{net::SocketAddr, path::PathBuf, time::Duration};
use task_manager::{ManagedTask, TaskManager};
Expand All @@ -36,21 +42,32 @@ pub struct Cli {
impl Cli {
pub async fn run(self) -> Result<()> {
let settings = Settings::new(self.config)?;
self.cmd.run(settings).await

match self.cmd {
Cmd::Server(daemon) => daemon.run(&settings).await,
Cmd::MigrateMobileTracker(csv_file) => {
custom_tracing::init(settings.log.clone(), settings.custom_tracing.clone()).await?;
let mobile_config_pool = settings.database.connect("mobile-config-store").await?;
let metadata_pool = settings.metadata.connect("mobile-config-metadata").await?;
sqlx::migrate!().run(&mobile_config_pool).await?;
migrate_mobile_tracker_locations(mobile_config_pool, metadata_pool, &csv_file.path)
.await?;
Ok(())
}
}
}
}

#[derive(Debug, clap::Subcommand)]
pub enum Cmd {
Server(Daemon),
// Oneshot command to migrate location data for mobile tracker
MigrateMobileTracker(CsvFile),
}

impl Cmd {
pub async fn run(&self, settings: Settings) -> Result<()> {
match self {
Self::Server(cmd) => cmd.run(&settings).await,
}
}
#[derive(Debug, clap::Args)]
pub struct CsvFile {
pub path: String,
}

#[derive(Debug, clap::Args)]
Expand Down
Loading