-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/report upgrade status to platform orchestrator (#391)
* update install script to generate candid files * report back upgrade status to platform orchestrator * remove fields from upgrade subnet report
- Loading branch information
1 parent
807e649
commit a17dfc8
Showing
19 changed files
with
185 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...er/platform_orchestrator/src/api/canister_management/get_subnets_upgrade_status_report.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use shared_utils::canister_specific::platform_orchestrator::types::SubnetUpgradeReport; | ||
|
||
use crate::CANISTER_DATA; | ||
|
||
#[ic_cdk_macros::query] | ||
pub async fn get_subnets_upgrade_status_report() -> SubnetUpgradeReport { | ||
CANISTER_DATA.with_borrow(|canister_data| canister_data.subnets_upgrade_report.clone()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...anister/platform_orchestrator/src/api/canister_management/report_subnet_upgrade_status.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use ic_cdk::caller; | ||
use shared_utils::canister_specific::user_index::types::UpgradeStatus; | ||
|
||
use crate::{utils::registered_subnet_orchestrator::RegisteredSubnetOrchestrator, CANISTER_DATA}; | ||
|
||
#[ic_cdk_macros::update] | ||
pub fn report_subnet_upgrade_status(subnet_upgrade_status: UpgradeStatus) -> Result<(), String> { | ||
let registered_subnet_orchestrator = RegisteredSubnetOrchestrator::new(caller())?; | ||
CANISTER_DATA.with_borrow_mut(|canister_data| { | ||
canister_data | ||
.subnets_upgrade_report | ||
.subnet_wise_report | ||
.insert( | ||
registered_subnet_orchestrator.get_canister_id(), | ||
subnet_upgrade_status, | ||
) | ||
}); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...r_index/src/api/upgrade_individual_user_template/get_index_details_last_upgrade_status.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
src/canister/user_index/src/data_model/canister_upgrade/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1 @@ | ||
use std::{ | ||
fmt::Display, | ||
time::{SystemTime, UNIX_EPOCH}, | ||
}; | ||
|
||
use candid::{CandidType, Deserialize, Principal}; | ||
use serde::Serialize; | ||
|
||
#[derive(CandidType, Deserialize, Clone, Serialize, Debug)] | ||
pub struct UpgradeStatus { | ||
pub version_number: u64, | ||
pub last_run_on: SystemTime, | ||
pub successful_upgrade_count: u32, | ||
pub failed_canister_ids: Vec<(Principal, Principal, String)>, | ||
#[serde(default)] | ||
pub version: String, | ||
} | ||
|
||
impl Display for UpgradeStatus { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "{:#?}", self) | ||
} | ||
} | ||
|
||
impl Default for UpgradeStatus { | ||
fn default() -> Self { | ||
Self { | ||
version_number: 0, | ||
last_run_on: UNIX_EPOCH, | ||
successful_upgrade_count: 0, | ||
failed_canister_ids: Vec::new(), | ||
version: String::from("v0.0.0") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.