Skip to main content

Crate ic_timers

Crate ic_timers 

Source
Expand description

Observable and recovery-aware timer primitives for Internet Computer canisters.

ic-timers is a higher-level wrapper around ic-cdk-timers, which remains the provider that arms and clears platform timers. This crate adds bounded coordination, scheduling, and observation above it.

The 0.3 runtime executes Once, after-completion, and pre-armed synchronous watchdog callbacks through one volatile canister-local registry. Consumers retain durable application authority and synchronously reconstruct retained registrations during their existing lifecycle hooks. Transient remove-on-stop callbacks use direct registration. Registration capabilities can observe exact armed provider-wakeup ownership without making snapshots or observations into scheduling authority.

Re-exports§

pub use schedule::ScheduleError;
pub use schedule::TimerCadence;
pub use schedule::TimerDirective;
pub use schedule::TimerSchedule;
pub use snapshot::DeclarationLifetime;
pub use snapshot::InactiveReason;
pub use snapshot::MAX_TIMER_LABEL_BYTES;
pub use snapshot::MeasurementSummary;
pub use snapshot::OrdinaryRuntimeStateSnapshot;
pub use snapshot::TimerCompletion;
pub use snapshot::TimerCompletionOutcome;
pub use snapshot::TimerControlFailure;
pub use snapshot::TimerCounters;
pub use snapshot::TimerDirectiveSnapshot;
pub use snapshot::TimerEpoch;
pub use snapshot::TimerIdentity;
pub use snapshot::TimerIdentityError;
pub use snapshot::TimerIdentityField;
pub use snapshot::TimerLabel;
pub use snapshot::TimerLabelError;
pub use snapshot::TimerLastOutcome;
pub use snapshot::TimerObservabilitySnapshot;
pub use snapshot::TimerOutcomeSnapshot;
pub use snapshot::TimerPerformance;
pub use snapshot::TimerPolicy;
pub use snapshot::TimerProcessCondition;
pub use snapshot::TimerRegistrationStatus;
pub use snapshot::TimerRunResult;
pub use snapshot::TimerRuntimeStateSnapshot;
pub use snapshot::TimerSchedulingMode;
pub use snapshot::TimerSnapshot;
pub use snapshot::WatchdogAttemptSnapshot;
pub use snapshot::WatchdogAttemptStatus;
pub use snapshot::WatchdogDecision;
pub use snapshot::WatchdogRunResult;
pub use snapshot::WatchdogRuntimeStateSnapshot;

Modules§

schedule
Checked cadence and scheduling decisions.
snapshot
Provider-neutral identity and coherent canonical snapshot values.

Structs§

AfterCompletionRegistration
Opaque non-clone claim for one after-completion callback.
OnceRegistration
Opaque non-clone claim for one registered Once callback.
TimerContext
Delegated control capability scoped to one exact consumer-work attempt.
WatchdogRegistration
Opaque non-clone claim for one pre-armed watchdog callback.

Enums§

RegisterError
Failure to claim one canonical timer identity.
TimerError
Failure from the canister-local timer runtime API.
TimerReconcileState
Desired volatile scheduling state during synchronous lifecycle reconciliation.

Constants§

MAX_TIMER_REGISTRATIONS
Maximum declarations owned by one canonical registry.

Functions§

consecutive_expected_failures
Return functional expected-failure state by identity without a full inventory.
initialize_runtime
Initialize the volatile canister-local runtime once for this Wasm instance.
reconcile_after_completion
Reconstruct or reconcile one after-completion declaration synchronously.
reconcile_once
Reconstruct or reconcile one Once declaration synchronously.
reconcile_watchdog
Reconstruct or reconcile one watchdog declaration synchronously.
register_after_completion
Register one asynchronous fixed-cadence after-completion callback.
register_once
Register one asynchronous Once callback without scheduling it.
register_watchdog
Register one synchronous pre-armed watchdog callback without scheduling it.
timer_snapshot
Return one coherent inert snapshot by identity.
timer_snapshots
Return the complete bounded inventory in deterministic identity order.