canic-core 0.69.3

Canic — a canister orchestration and management toolkit for the Internet Computer
Documentation
//! Module: ops::storage::children::mapper
//!
//! Responsibility: convert child cache records into canister info views.
//! Does not own: child cache mutation, topology workflow, or DTO definitions.
//! Boundary: storage ops conversion layer for child cache records.

use crate::{
    cdk::types::Principal, dto::canister::CanisterInfo, storage::canister::CanisterRecord,
};

///
/// CanisterRecordMapper
///
/// Storage-ops mapper for child cache records and canister info views.
///

pub struct CanisterRecordMapper;

impl CanisterRecordMapper {
    #[must_use]
    pub fn record_to_response(pid: Principal, record: CanisterRecord) -> CanisterInfo {
        CanisterInfo {
            pid,
            role: record.role,
            parent_pid: record.parent_pid,
            module_hash: record.module_hash,
            created_at: record.created_at,
        }
    }
}