|
@@ -51,6 +51,7 @@ pub struct Config {
|
|
// map of distributor name to IP:port to contact it
|
|
// map of distributor name to IP:port to contact it
|
|
pub distributors: BTreeMap<BridgeDistributor, String>,
|
|
pub distributors: BTreeMap<BridgeDistributor, String>,
|
|
extra_infos_base_url: String,
|
|
extra_infos_base_url: String,
|
|
|
|
+ verify_blockages_url: String,
|
|
|
|
|
|
// confidence required to consider a bridge blocked
|
|
// confidence required to consider a bridge blocked
|
|
confidence: f64,
|
|
confidence: f64,
|
|
@@ -92,6 +93,7 @@ async fn update_daily_info(
|
|
db: &Db,
|
|
db: &Db,
|
|
distributors: &BTreeMap<BridgeDistributor, String>,
|
|
distributors: &BTreeMap<BridgeDistributor, String>,
|
|
extra_infos_base_url: &str,
|
|
extra_infos_base_url: &str,
|
|
|
|
+ verify_blockages_url: &str,
|
|
confidence: f64,
|
|
confidence: f64,
|
|
max_threshold: u32,
|
|
max_threshold: u32,
|
|
scaling_factor: f64,
|
|
scaling_factor: f64,
|
|
@@ -109,7 +111,10 @@ async fn update_daily_info(
|
|
min_historical_days,
|
|
min_historical_days,
|
|
max_historical_days,
|
|
max_historical_days,
|
|
);
|
|
);
|
|
- // TODO: Verify the new blockages
|
|
|
|
|
|
+
|
|
|
|
+ // This implementation will vary based on scanning infrastructure
|
|
|
|
+ let new_blockages = verify_blockages(verify_blockages_url, new_blockages).await;
|
|
|
|
+
|
|
commit_blockages(db, &new_blockages);
|
|
commit_blockages(db, &new_blockages);
|
|
report_blockages(distributors, new_blockages.clone()).await;
|
|
report_blockages(distributors, new_blockages.clone()).await;
|
|
|
|
|
|
@@ -132,6 +137,7 @@ async fn create_context_manager(
|
|
db_config: DbConfig,
|
|
db_config: DbConfig,
|
|
distributors: BTreeMap<BridgeDistributor, String>,
|
|
distributors: BTreeMap<BridgeDistributor, String>,
|
|
extra_infos_base_url: &str,
|
|
extra_infos_base_url: &str,
|
|
|
|
+ verify_blockages_url: &str,
|
|
confidence: f64,
|
|
confidence: f64,
|
|
max_threshold: u32,
|
|
max_threshold: u32,
|
|
scaling_factor: f64,
|
|
scaling_factor: f64,
|
|
@@ -141,7 +147,7 @@ async fn create_context_manager(
|
|
mut kill: broadcast::Receiver<()>,
|
|
mut kill: broadcast::Receiver<()>,
|
|
) {
|
|
) {
|
|
tokio::select! {
|
|
tokio::select! {
|
|
- create_context = context_manager(db_config, distributors, extra_infos_base_url, confidence, max_threshold, scaling_factor, min_historical_days, max_historical_days, context_rx) => create_context,
|
|
|
|
|
|
+ create_context = context_manager(db_config, distributors, extra_infos_base_url, verify_blockages_url, confidence, max_threshold, scaling_factor, min_historical_days, max_historical_days, context_rx) => create_context,
|
|
_ = kill.recv() => {println!("Shut down manager");},
|
|
_ = kill.recv() => {println!("Shut down manager");},
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -150,6 +156,7 @@ async fn context_manager(
|
|
db_config: DbConfig,
|
|
db_config: DbConfig,
|
|
distributors: BTreeMap<BridgeDistributor, String>,
|
|
distributors: BTreeMap<BridgeDistributor, String>,
|
|
extra_infos_base_url: &str,
|
|
extra_infos_base_url: &str,
|
|
|
|
+ verify_blockages_url: &str,
|
|
confidence: f64,
|
|
confidence: f64,
|
|
max_threshold: u32,
|
|
max_threshold: u32,
|
|
scaling_factor: f64,
|
|
scaling_factor: f64,
|
|
@@ -202,6 +209,7 @@ async fn context_manager(
|
|
&db,
|
|
&db,
|
|
&distributors,
|
|
&distributors,
|
|
extra_infos_base_url,
|
|
extra_infos_base_url,
|
|
|
|
+ verify_blockages_url,
|
|
confidence,
|
|
confidence,
|
|
max_threshold,
|
|
max_threshold,
|
|
scaling_factor,
|
|
scaling_factor,
|
|
@@ -296,6 +304,7 @@ async fn main() {
|
|
config.db,
|
|
config.db,
|
|
config.distributors,
|
|
config.distributors,
|
|
&config.extra_infos_base_url,
|
|
&config.extra_infos_base_url,
|
|
|
|
+ &config.verify_blockages_url,
|
|
config.confidence,
|
|
config.confidence,
|
|
config.max_threshold,
|
|
config.max_threshold,
|
|
config.scaling_factor,
|
|
config.scaling_factor,
|