View Source Exshome.Dependency.GenServerDependency behaviour (Exshome - Elixir Smart Home v0.1.7)

This module stores generic API for GenServer based dependencies.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Validates configuration for the dependency and raises if it is invalid. Available configuration options: :name (required) - name of the dependency :dependencies (default []) - dependencies list :events (default []) - events to subscribe, where key is a module, and value is a topic

Link to this section Callbacks

Link to this callback

handle_call(request, from, state)

View Source (optional)
@callback handle_call(
  request :: term(),
  GenServer.from(),
  state :: Exshome.Dependency.GenServerDependency.DependencyState.t()
) ::
  {:reply, reply, new_state}
  | {:reply, reply, new_state, timeout() | :hibernate | {:continue, term()}}
  | {:noreply, new_state}
  | {:noreply, new_state, timeout() | :hibernate | {:continue, term()}}
  | {:stop, reason, reply, new_state}
  | {:stop, reason, new_state}
when reply: term(),
     new_state: Exshome.Dependency.GenServerDependency.DependencyState.t(),
     reason: term()
Link to this callback

handle_dependency_change(t)

View Source
Link to this callback

handle_event(event_message, t)

View Source
Link to this callback

handle_info(message, t)

View Source (optional)
@callback handle_info(
  message :: any(),
  Exshome.Dependency.GenServerDependency.DependencyState.t()
) ::
  {:noreply, new_state}
  | {:noreply, new_state, timeout() | :hibernate | {:continue, term()}}
  | {:stop, reason :: term(), new_state}
when new_state: Exshome.Dependency.GenServerDependency.DependencyState.t()
@callback parse_opts(map()) :: any()

Link to this section Functions

@spec call(GenServer.server(), any()) :: any()

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec get_pid(atom() | pid()) :: pid() | nil

See ExshomeTest.Hooks.Dependency.get_pid/1.

@spec get_value(GenServer.server()) :: any()
Link to this function

handle_dependency_change(state)

View Source
Link to this function

handle_dependency_info(arg, state)

View Source
@spec modules(app :: atom()) :: MapSet.t(Exshome.Dependency.dependency())
@spec start_link(map()) :: GenServer.on_start()
Link to this function

subscribe_to_dependencies(state, dependencies)

View Source
Link to this function

subscribe_to_events(state, events)

View Source
Link to this function

update_data(state, update_fn)

View Source
Link to this function

update_value(state, value)

View Source
Link to this function

validate_config!(config)

View Source
@spec validate_config!(Keyword.t()) :: keyword()

Validates configuration for the dependency and raises if it is invalid. Available configuration options: :name (required) - name of the dependency :dependencies (default []) - dependencies list :events (default []) - events to subscribe, where key is a module, and value is a topic

Link to this function

validate_module!(env, bytecode)

View Source
@spec validate_module!(Macro.Env.t(), String.t()) :: keyword()