canic_core/api/
mod.rs

1//! Public API façade for canister endpoints.
2//!
3//! This module contains thin wrappers exposed to proc-macro–generated
4//! endpoints. Functions here translate public API calls into internal
5//! workflow or ops calls and map internal errors into `PublicError`.
6//!
7//! No orchestration or business logic should live here.
8//! Any wrapper callable from an endpoint must return a `Result` so errors
9//! are consistently mapped at the boundary.
10
11pub mod access;
12pub mod bootstrap;
13pub mod cascade;
14pub mod config;
15pub mod error;
16pub mod ic;
17pub mod icts;
18pub mod lifecycle;
19pub mod placement;
20pub mod pool;
21pub mod rpc;
22pub mod state;
23pub mod timer;
24pub mod topology;
25pub mod wasm;
26
27///
28/// Query Wrappers
29/// (these modules have nothing else other than safe, public Query APIs)
30///
31
32pub mod cycles {
33    pub use crate::workflow::runtime::cycles::query::CycleTrackerQuery;
34}
35pub mod env {
36    pub use crate::workflow::env::query::EnvQuery;
37}
38pub mod icrc {
39    pub use crate::workflow::icrc::query::{Icrc10Query, Icrc21Query};
40}
41pub mod log {
42    pub use crate::workflow::log::query::LogQuery;
43}
44pub mod memory {
45    pub use crate::workflow::memory::query::MemoryQuery;
46}
47pub mod metrics {
48    pub use crate::workflow::metrics::query::MetricsQuery;
49}
50
51///
52/// EndpointCall
53///
54
55#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
56pub struct EndpointCall {
57    pub endpoint: EndpointId,
58    pub kind: EndpointCallKind,
59}
60
61///
62/// EndpointId
63///
64
65#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
66pub struct EndpointId {
67    pub name: &'static str,
68}
69
70impl EndpointId {
71    #[must_use]
72    pub const fn new(name: &'static str) -> Self {
73        Self { name }
74    }
75}
76
77///
78/// EndpointCallKind
79///
80
81#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
82pub enum EndpointCallKind {
83    Query,
84    QueryComposite,
85    Update,
86}