Skip to main content

Module progress

Module progress 

Source
Expand description

Global decode progress tracking.

Uses atomics so it is safe to call from rayon worker threads. When the wasm feature is enabled, an optional JS callback is invoked on each advance() to drive a real-time progress bar via Web Worker postMessage.

Functionsยง

advance
Advance progress by one step and notify the callback (if set). Step is capped at total to avoid displaying values like โ€œ84/15โ€. When total is 0 (indeterminate), step still advances freely so that the UI can show activity; init() with the real total will follow.
advance_by
Advance progress by n steps. Convenience wrapper that calls advance in a loop.
cancel
Request cancellation of the current decode operation.
check_cancelled
Check for cancellation and return an error if requested.
finish
Mark progress as complete (step = total) and notify.
get
Read the current (step, total) progress.
init
Reset progress to 0 and set the total step count. Also resets the cancellation flag so a fresh decode starts clean.
is_cancelled
Returns true if cancellation has been requested.
set_total
Set (or update) the total without resetting the current step. Used by pipeline code that discovers the real total mid-flight (e.g. after counting delta candidates).