livery_client_balance (livery v0.2.0)
View SourceClient layer: spread requests across a pool of endpoints.
Picks an endpoint from the pool named in the opts, rewrites the request
to target it, and records the outcome so a failing endpoint is ejected
and a recovering one is probed back in. Selection load and health live in
livery_client_balance_store. Add it with livery_client:balance/1.
Opts: name (required), endpoints (a list of base URLs, or a
{Module, Arg} discovery pair), policy (p2c default | round_robin),
eject_after (consecutive failures to eject, default 5), eject_for
(ms ejected before a half-open probe, default 10000), fail_status
(what counts as a failure: a fun((status()) -> boolean()) or a list of
statuses; default treats any status >= 500 and any {error, _} as a
failure).
Summary
Functions
-spec call(livery_client:request(), livery_client:next(), map()) -> {ok, livery_client:response()} | {error, term()}.