ocibuild_http (ocibuild v0.10.4)
View SourcePublic API for supervised HTTP operations.
This module provides a clean interface to the HTTP supervision tree. It handles starting/stopping the supervisor on demand and provides the parallel map functionality used for layer downloads/uploads.
Usage:
%% Start is automatic, but can be explicit
ok = ocibuild_http:start(),
%% Execute HTTP operations in parallel
Results = ocibuild_http:pmap(fun download_layer/1, Layers),
%% Clean shutdown
ok = ocibuild_http:stop().
Summary
Functions
Execute function on each item in parallel, return results in order.
Execute function on each item in parallel with specified max concurrency.
Start the HTTP supervisor tree.
Stop the HTTP supervisor tree.
Functions
Execute function on each item in parallel, return results in order.
Uses default max concurrency of 4 workers. Automatically starts the HTTP supervisor if not already running.
-spec pmap(Fun :: fun((term()) -> term()), Items :: [term()], MaxWorkers :: pos_integer()) -> [term()].
Execute function on each item in parallel with specified max concurrency.
Returns results in the same order as input items. Automatically starts the HTTP supervisor if not already running.
If any worker fails, the error is propagated to the caller.
-spec start() -> ok | {error, term()}.
Start the HTTP supervisor tree.
This is called automatically by pmap/2,3 if not already started.
Safe to call multiple times (idempotent).
-spec stop() -> ok.
Stop the HTTP supervisor tree.
This triggers a clean shutdown cascade:
- Supervisor terminates all children (pool and workers)
- Workers clean up their httpc profiles in terminate/2
Safe to call multiple times (idempotent).