Skip to main content

ic_timers/
lib.rs

1//! Observable and recovery-aware timer primitives for Internet Computer
2//! canisters.
3//!
4//! `ic-timers` is a higher-level wrapper around `ic-cdk-timers`, which remains
5//! the provider that arms and clears platform timers. This crate adds
6//! bounded coordination, scheduling, and observation above it.
7//!
8//! The 0.3 runtime executes `Once`, after-completion, and pre-armed
9//! synchronous watchdog callbacks through one volatile canister-local registry.
10//! Consumers retain durable application authority and synchronously reconstruct
11//! retained registrations during their existing lifecycle hooks. Transient
12//! remove-on-stop callbacks use direct registration. Registration capabilities
13//! can observe exact armed provider-wakeup ownership without making snapshots
14//! or observations into scheduling authority.
15
16#![forbid(unsafe_code)]
17#![deny(rustdoc::broken_intra_doc_links)]
18
19mod control;
20mod platform;
21mod registry;
22mod runtime;
23pub mod schedule;
24pub mod snapshot;
25
26pub use registry::{MAX_TIMER_REGISTRATIONS, RegisterError};
27pub use runtime::{
28    AfterCompletionRegistration, OnceRegistration, TimerContext, TimerError, TimerReconcileState,
29    WatchdogRegistration, consecutive_expected_failures, initialize_runtime,
30    reconcile_after_completion, reconcile_once, reconcile_watchdog, register_after_completion,
31    register_once, register_watchdog, timer_snapshot, timer_snapshots,
32};
33pub use schedule::{ScheduleError, TimerCadence, TimerDirective, TimerSchedule};
34pub use snapshot::{
35    DeclarationLifetime, InactiveReason, MAX_TIMER_LABEL_BYTES, MeasurementSummary,
36    OrdinaryRuntimeStateSnapshot, TimerCompletion, TimerCompletionOutcome, TimerControlFailure,
37    TimerCounters, TimerDirectiveSnapshot, TimerEpoch, TimerIdentity, TimerIdentityError,
38    TimerIdentityField, TimerLabel, TimerLabelError, TimerLastOutcome, TimerObservabilitySnapshot,
39    TimerOutcomeSnapshot, TimerPerformance, TimerPolicy, TimerProcessCondition,
40    TimerRegistrationStatus, TimerRunResult, TimerRuntimeStateSnapshot, TimerSchedulingMode,
41    TimerSnapshot, WatchdogAttemptSnapshot, WatchdogAttemptStatus, WatchdogDecision,
42    WatchdogRunResult, WatchdogRuntimeStateSnapshot,
43};