View Source Bolt.Sips.LoadBalancer (Boltx v0.0.1)

a simple load balancer used for selecting a server address from a map. The address is selected based on how many hits has; least reused url.

Summary

Functions

sort by total number of hits and return the least reused url

Functions

@spec least_reused_url(map()) :: {:ok, String.t()} | {:error, :not_found}

sort by total number of hits and return the least reused url

## Examples

iex> least_reused_url(%{"url1" => 10, "url2" => 5})
{:ok, "url2"}

iex> least_reused_url(%{})
{:error, :not_found}