canic_core/domain/subnet.rs
1//! Module: domain::subnet
2//!
3//! Responsibility: define runtime subnet identity values used during root
4//! lifecycle initialization.
5//! Does not own: config parsing, endpoint DTO structs, or stable subnet
6//! records.
7//! Boundary: DTOs re-export these values for init-argument compatibility while
8//! workflow consumes the domain owner directly.
9
10use crate::{cdk::types::Principal, ids::SubnetRole};
11use candid::CandidType;
12use serde::Deserialize;
13
14//
15// SubnetIdentity
16//
17// Represents the *runtime identity* of the subnet this canister is executing in.
18// Must never be constructed from configuration alone.
19//
20
21#[derive(CandidType, Debug, Deserialize)]
22pub enum SubnetIdentity {
23 Prime,
24
25 PrimeWithModuleHash(Vec<u8>),
26
27 // this subnet is general-purpose subnet that syncs from Prime
28 Standard(SubnetContextParams),
29
30 // do not attempt subnet discovery (test / support mode)
31 Manual,
32}
33
34//
35// SubnetContextParams
36// everything we need to populate the SubnetContext on a non-Prime subnet
37//
38
39#[derive(CandidType, Debug, Deserialize)]
40pub struct SubnetContextParams {
41 pub subnet_type: SubnetRole,
42 pub prime_root_pid: Principal,
43}