antikythera v0.4.0 AntikytheraCore.Config.Gear View Source

Link to this section Summary

Functions

Type-aware getter for alerts.

Type-aware setter for alerts.

Type-aware getter for domains.

Type-aware setter for domains.

Type-aware getter for kv.

Type-aware setter for kv.

Type-aware getter for log_level.

Type-aware setter for log_level.

Creates a new instance of AntikytheraCore.Config.Gear by using the given dict.

A variant of new/1 which returns t or raise if validation fails.

Updates an existing instance of AntikytheraCore.Config.Gear with the given dict. The values in the dict are validated by each field's valid?/1 function. Returns {:ok, valid_struct} or {:error, reason}.

A variant of update/2 which returns t or raise if validation fails. In other words, update/2 followed by Croma.Result.get!/1.

Checks if the given value belongs to t/0 or not.

Link to this section Types

Specs

t() :: %AntikytheraCore.Config.Gear{
  alerts: AntikytheraCore.Alert.HandlerConfigsMap.t(),
  domains: Antikythera.DomainList.t(),
  kv: Croma.Map.t(),
  log_level: AntikytheraCore.GearLog.Level.t()
}

Link to this section Functions

Specs

Type-aware getter for alerts.

Specs

Type-aware setter for alerts.

Specs

default() :: t()

Specs

domains(t()) :: Antikythera.DomainList.t()

Type-aware getter for domains.

Specs

domains(t(), Antikythera.DomainList.t()) :: t()

Type-aware setter for domains.

Link to this function

dump_all_from_env_to_file()

View Source

Specs

dump_all_from_env_to_file() :: :ok
Link to this function

ensure_loaded(gear_name)

View Source

Specs

ensure_loaded(Antikythera.GearName.t()) :: :ok

Specs

kv(t()) :: Croma.Map.t()

Type-aware getter for kv.

Specs

kv(t(), Croma.Map.t()) :: t()

Type-aware setter for kv.

Link to this function

load_all(last_checked_at)

View Source

Specs

load_all(Antikythera.SecondsSinceEpoch.t()) :: :ok

Specs

Type-aware getter for log_level.

Specs

log_level(t(), AntikytheraCore.GearLog.Level.t()) :: t()

Type-aware setter for log_level.

Specs

new(term()) :: Croma.Result.t(t())

Creates a new instance of AntikytheraCore.Config.Gear by using the given dict.

Returns {:ok, valid_struct} or {:error, reason}.

The values in the dict are validated by each field's valid?/1 function. If the value was invalid, it will be passed to new/1 of the field

For missing fields, followings will be tried:

  • default/0 of each field type
  • new/1 of each field type, with empty map as input

Specs

new!(term()) :: t()

A variant of new/1 which returns t or raise if validation fails.

In other words, new/1 followed by Croma.Result.get!/1.

Specs

read(Antikythera.GearName.t()) :: t()

Specs

read_all() :: Keyword.t(t())

Specs

update(t(), Dict.t()) :: Croma.Result.t(t())

Updates an existing instance of AntikytheraCore.Config.Gear with the given dict. The values in the dict are validated by each field's valid?/1 function. Returns {:ok, valid_struct} or {:error, reason}.

Specs

update!(t(), Dict.t()) :: t()

A variant of update/2 which returns t or raise if validation fails. In other words, update/2 followed by Croma.Result.get!/1.

Specs

valid?(term()) :: boolean()

Checks if the given value belongs to t/0 or not.

Link to this function

write(gear_name, config)

View Source

Specs

write(Antikythera.GearName.t(), t()) :: :ok