View Source Yggdrasil.Config.Icon (ICON 2.0 SDK v0.1.6)

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, {:error, errors} if they are not. errors will be a list of all errors encountered while getting required variables.

Validates that all required variables are present. Returns :ok if they are, raises if they're not.

Link to this section Functions

Link to this function

max_retries(namespace \\ nil)

View Source

Specs

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:

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
Link to this function

max_retries!(namespace \\ nil)

View Source

Specs

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:

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.

Link to this function

preload(namespace \\ nil)

View Source

Specs

preload(Skogsra.Env.namespace()) :: :ok

Preloads all variables in a namespace if supplied.

Link to this function

put_max_retries(value, namespace \\ nil)

View Source

Specs

put_max_retries(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.Icon.max_retries/0. Optionally, receives the namespace.

Link to this function

put_slot_size(value, namespace \\ nil)

View Source

Specs

put_slot_size(integer(), Skogsra.Env.namespace()) :: :ok | {:error, binary()}

Puts the value to Yggdrasil.Config.Icon.slot_size/0. Optionally, receives the namespace.

Link to this function

reload_max_retries(namespace \\ nil)

View Source

Specs

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.

Link to this function

reload_slot_size(namespace \\ nil)

View Source

Specs

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.

Link to this function

slot_size(namespace \\ nil)

View Source

Specs

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:

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
Link to this function

slot_size!(namespace \\ nil)

View Source

Specs

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:

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.

Link to this function

template(filename, options \\ [])

View Source

Specs

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.
Link to this function

validate(namespace \\ nil)

View Source

Specs

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).

Link to this function

validate!(namespace \\ nil)

View Source

Specs

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).