View Source Yggdrasil.Config.Icon (ICON 2.0 SDK v0.2.3)
This module defines configuration variables for ICON 2.0 WebSocket connection.
Link to this section Summary
Functions
WebSocket max retries for the backoff algorithm. Defaults to 3
.
WebSocket max retries for the backoff algorithm. Defaults to 3
.
Preloads all variables in a namespace
if supplied.
Puts the value
to Yggdrasil.Config.Icon.max_retries/0
. Optionally, receives
the namespace
.
Puts the value
to Yggdrasil.Config.Icon.slot_size/0
. Optionally, receives
the namespace
.
Reloads the value for Yggdrasil.Config.Icon.max_retries/0
. Optionally, receives
the namespace
for the variable.
Reloads the value for Yggdrasil.Config.Icon.slot_size/0
. Optionally, receives
the namespace
for the variable.
WebSocket slot size for the backoff algorithm. Defaults to 10
.
WebSocket slot size for the backoff algorithm. Defaults to 10
.
Creates a template for OS environment variables given a filename
.
Additionally, it can receive a list of options
Validates that all required variables are present.
Returns :ok
if they are, raises if they're not.
Validates that all required variables are present.
Returns :ok
if they are, {:error, errors}
if they are not. errors
will be a list of all errors encountered while getting required variables.
Link to this section Functions
@spec max_retries!(Skogsra.Env.namespace()) :: integer() | no_return()
WebSocket max retries for the backoff algorithm. Defaults to 3
.
The backoff algorithm is exponential:
backoff_time = retries² * random(1, slot) * 1_000ms
where:
retries
is less or equal tomax_retries!/0
,- and
slot
is given byslot_size!/0
.
iex> Yggdrasil.Config.Icon.max_retries!()
3
Bang version of Yggdrasil.Config.Icon.max_retries/0
(fails on error). Optionally,
receives the namespace
for the variable.
@spec max_retries(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}
WebSocket max retries for the backoff algorithm. Defaults to 3
.
The backoff algorithm is exponential:
backoff_time = retries² * random(1, slot) * 1_000ms
where:
retries
is less or equal tomax_retries!/0
,- and
slot
is given byslot_size!/0
.
iex> Yggdrasil.Config.Icon.max_retries!()
3
Calling Yggdrasil.Config.Icon.max_retries()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "YGGDRASIL_ICON_MAX_RETRIES"
- Type: :integer
- Default: 3
- Required: true
- Cached: true
@spec preload(Skogsra.Env.namespace()) :: :ok
Preloads all variables in a namespace
if supplied.
@spec put_max_retries(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Yggdrasil.Config.Icon.max_retries/0
. Optionally, receives
the namespace
.
@spec put_slot_size(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}
Puts the value
to Yggdrasil.Config.Icon.slot_size/0
. Optionally, receives
the namespace
.
@spec reload_max_retries(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}
Reloads the value for Yggdrasil.Config.Icon.max_retries/0
. Optionally, receives
the namespace
for the variable.
@spec reload_slot_size(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}
Reloads the value for Yggdrasil.Config.Icon.slot_size/0
. Optionally, receives
the namespace
for the variable.
@spec slot_size!(Skogsra.Env.namespace()) :: integer() | no_return()
WebSocket slot size for the backoff algorithm. Defaults to 10
.
The backoff algorithm is exponential:
backoff_time = retries² * random(1, slot) * 1_000ms
where:
retries
is less or equal tomax_retries!/0
,- and
slot
is given byslot_size!/0
.
iex> Yggdrasil.Config.Icon.slot_size!()
10
Bang version of Yggdrasil.Config.Icon.slot_size/0
(fails on error). Optionally,
receives the namespace
for the variable.
@spec slot_size(Skogsra.Env.namespace()) :: {:ok, integer()} | {:error, binary()}
WebSocket slot size for the backoff algorithm. Defaults to 10
.
The backoff algorithm is exponential:
backoff_time = retries² * random(1, slot) * 1_000ms
where:
retries
is less or equal tomax_retries!/0
,- and
slot
is given byslot_size!/0
.
iex> Yggdrasil.Config.Icon.slot_size!()
10
Calling Yggdrasil.Config.Icon.slot_size()
will ensure the following:
- Binding order: [:system, :config]
- OS environment variable: "YGGDRASIL_ICON_SLOT_SIZE"
- Type: :integer
- Default: 10
- Required: true
- Cached: true
@spec template( Path.t(), keyword() ) :: :ok | {:error, File.posix()}
Creates a template for OS environment variables given a filename
.
Additionally, it can receive a list of options:
type
: What kind of file it will generate (:elixir
,:unix
,:windows
).namespace
: Namespace for the variables.
@spec validate!(Skogsra.Env.namespace()) :: :ok | no_return()
Validates that all required variables are present.
Returns :ok
if they are, raises if they're not.
It is possible to provide a namespace
as argument (defaults to nil
).
@spec validate(Skogsra.Env.namespace()) :: :ok | {:error, [binary()]}
Validates that all required variables are present.
Returns :ok
if they are, {:error, errors}
if they are not. errors
will be a list of all errors encountered while getting required variables.
It is possible to provide a namespace
as argument (defaults to nil
).