ocibuild_progress (ocibuild v0.10.4)

View Source

Multi-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

clear()

-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.

complete(Ref)

-spec complete(reference()) -> ok.

Mark a progress bar as complete.

make_callback(Opts)

-spec make_callback(map()) -> fun((map()) -> ok).

Create a progress callback function compatible with ocibuild_registry.

The callback will register a bar on first call and update it on subsequent calls.

manager_loop(State)

register_bar(Opts)

-spec register_bar(map()) -> reference().

Register a new progress bar. Returns a reference for updates.

start_manager()

-spec start_manager() -> ok | {error, already_started}.

Start the progress manager process.

stop_manager()

-spec stop_manager() -> ok.

Stop the progress manager and clean up.

update(Ref, Current)

-spec update(reference(), non_neg_integer()) -> ok.

Update progress for a bar.