ocibuild_progress (ocibuild v0.10.4)
View SourceMulti-line progress bar display for concurrent operations.
Provides process-bound progress bars that can display multiple concurrent download/upload operations, each on its own terminal line.
Usage:
%% Start the progress manager (call once before parallel operations)
ocibuild_progress:start_manager(),
%% In each worker process, register a progress bar
Ref = ocibuild_progress:register_bar(#{
label => ~"Layer 1/2 (amd64)",
total => 28400000
}),
%% Update progress (called repeatedly during download/upload)
ocibuild_progress:update(Ref, 5000000),
%% Mark as complete
ocibuild_progress:complete(Ref),
%% Stop the manager when done
ocibuild_progress:stop_manager().
Summary
Functions
Clear all progress bars from the manager.
Mark a progress bar as complete.
Create a progress callback function compatible with ocibuild_registry.
Print a status line through the progress manager.
Register a new progress bar. Returns a reference for updates.
Start the progress manager process.
Stop the progress manager and clean up.
Update progress for a bar.
Functions
-spec clear() -> ok.
Clear all progress bars from the manager.
Use this between major operations (e.g., between save and push) to reset the display and start fresh with new progress bars.
-spec complete(reference()) -> ok.
Mark a progress bar as complete.
Create a progress callback function compatible with ocibuild_registry.
The callback will register a bar on first call and update it on subsequent calls.
Print a status line through the progress manager.
Use this instead of io:format when progress bars are active to avoid output conflicts. The message is printed synchronously to ensure ordering.
Register a new progress bar. Returns a reference for updates.
-spec start_manager() -> ok | {error, already_started}.
Start the progress manager process.
-spec stop_manager() -> ok.
Stop the progress manager and clean up.
-spec update(reference(), non_neg_integer()) -> ok.
Update progress for a bar.