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 runtime executes `Once`, after-completion, and pre-armed synchronous
9//! 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)]
18mod control;
19mod platform;
20mod registry;
21mod runtime;
22mod schedule;
23mod snapshot;
24
25pub use registry::{MAX_TIMER_REGISTRATIONS, RegisterError};
26pub use runtime::{
27    AfterCompletionContext, AfterCompletionRegistration, OnceContext, OnceRegistration, TimerError,
28    TimerReconcileState, WatchdogContext, WatchdogRegistration, consecutive_expected_failures,
29    initialize_runtime, reconcile_after_completion, reconcile_once, reconcile_watchdog,
30    register_after_completion, register_once, register_watchdog, timer_snapshot, timer_snapshots,
31};
32pub use schedule::{ScheduleError, TimerCadence, TimerDirective, TimerSchedule};
33pub use snapshot::{
34    DeclarationLifetime, InactiveReason, MAX_TIMER_IDENTITY_COMPONENT_BYTES, MeasurementSummary,
35    MemoryPageExtent, MemoryPageSample, MemoryPageSummary, OrdinaryRuntimeStateSnapshot,
36    TimerCompletion, TimerCompletionOutcome, TimerControlFailure, TimerCounters,
37    TimerDirectiveSnapshot, TimerEpoch, TimerIdentity, TimerIdentityError, TimerIdentityField,
38    TimerLastOutcome, TimerObservabilitySnapshot, TimerOutcomeSnapshot, TimerPerformance,
39    TimerPolicy, TimerProcessCondition, TimerRegistrationStatus, TimerRunResult,
40    TimerRuntimeStateSnapshot, TimerSchedulingMode, TimerSnapshot, WatchdogAttemptSnapshot,
41    WatchdogAttemptStatus, WatchdogDecision, WatchdogRunResult, WatchdogRuntimeStateSnapshot,
42};