ocibuild_http_pool (ocibuild v0.10.4)

View Source

HTTP pool coordinator for parallel operations.

This gen_server coordinates parallel HTTP operations with bounded concurrency. It provides a pmap/2,3 interface similar to the existing pmap_bounded/3 but uses supervised HTTP workers.

Key features:

  • Bounded concurrency (default: 4 workers)
  • Results returned in original order
  • Fail-fast: one worker crash fails entire operation
  • Clean shutdown via OTP supervision

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

Stop the pool coordinator.

Functions

handle_call/3

handle_cast(Msg, State)

handle_info/2

init/1

pmap(Fun, Items)

-spec pmap(Fun :: fun((term()) -> term()), Items :: [term()]) -> [term()].

Execute function on each item in parallel, return results in order.

Uses default max concurrency of 4 workers.

pmap(Fun, Items, MaxWorkers)

-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. If any worker crashes or returns an error, the entire operation fails.

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.

Start the HTTP pool coordinator.

stop()

-spec stop() -> ok.

Stop the pool coordinator.

This will cause the supervisor to shut down via auto_shutdown.

terminate(Reason, State)