livery_client_discover behaviour (livery v0.2.0)

View Source

Behaviour for resolving a balance pool's endpoints.

A provider turns some Arg into the list of endpoint base URLs the balancer should spread across. The shipped provider, livery_client_discover_static, just returns a fixed list; live providers (periodic DNS, a registry watcher) can implement the same callback later without touching the balancer.

The endpoints option of livery_client:balance/1 is either a plain list (sugar for the static provider) or {Module, Arg} naming a provider.

Summary

Functions

Resolve an endpoints option to a concrete list of base URLs.

Types

endpoints()

-type endpoints() :: [binary()] | {module(), term()}.

Callbacks

endpoints(Arg)

-callback endpoints(Arg :: term()) -> [binary()].

Functions

resolve/1

-spec resolve(endpoints()) -> [binary()].

Resolve an endpoints option to a concrete list of base URLs.