canic_host/release_set/
mod.rs1use std::time::{SystemTime, UNIX_EPOCH};
4
5mod config;
6mod manifest;
7mod paths;
8mod stage;
9
10pub use config::{
11 AttachedFleetRole, ConfiguredPoolExpectation, ConfiguredRoleLifecycle, DeclaredFleetRole,
12 LOCAL_ROOT_MIN_READY_CYCLES, RenamedFleetRole, attach_fleet_role, configured_bootstrap_roles,
13 configured_controllers, configured_deployable_roles, configured_fleet_name,
14 configured_install_targets, configured_local_root_create_cycles, configured_pool_expectations,
15 configured_release_roles, configured_role_auto_create, configured_role_capabilities,
16 configured_role_details, configured_role_kinds, configured_role_lifecycle,
17 configured_role_metrics_profiles, configured_role_topups, declare_fleet_role,
18 matching_fleet_config_paths, plan_attach_fleet_role, plan_declare_fleet_role,
19 plan_rename_fleet_role, rename_fleet_role,
20};
21pub use manifest::{
22 ReleaseSetEntry, RootReleaseSetManifest, emit_root_release_set_manifest,
23 emit_root_release_set_manifest_if_ready, emit_root_release_set_manifest_with_config,
24 load_root_release_set_manifest,
25};
26pub use paths::{
27 canister_manifest_path, canisters_root, config_path, display_workspace_path, icp_root,
28 load_root_package_version, load_workspace_package_version, resolve_artifact_root,
29 root_manifest_path, root_release_set_manifest_path, workspace_manifest_path, workspace_root,
30};
31use stage::build_release_set_entry;
32pub(crate) use stage::icp_query_on_network;
33pub use stage::{resume_root_bootstrap, stage_root_release_set};
34
35pub(super) const CANISTERS_ROOT_RELATIVE: &str = "fleets";
36pub(super) const ROOT_CONFIG_FILE: &str = "canic.toml";
37pub(super) const WORKSPACE_MANIFEST_RELATIVE: &str = "Cargo.toml";
38pub(crate) const ROOT_RELEASE_SET_MANIFEST_FILE: &str = "root.release-set.json";
39pub(super) const GZIP_MAGIC: [u8; 2] = [0x1f, 0x8b];
40pub(super) const WASM_MAGIC: [u8; 4] = [0x00, 0x61, 0x73, 0x6d];
41
42pub(super) fn root_time_secs() -> Result<u64, Box<dyn std::error::Error>> {
45 let now = SystemTime::now()
46 .duration_since(UNIX_EPOCH)
47 .map_err(|err| format!("system clock before unix epoch: {err}"))?;
48 Ok(now.as_secs())
49}
50
51#[cfg(test)]
52mod tests;