View Source NervesHubLink.Extensions behaviour (nerves_hub_link v2.6.0)

Summary

Callbacks

Invoked when routing an Extension event

Functions

Attach specified extensions

Returns a specification to start this module under a supervisor.

Detach specified extensions

List extensions currently available

Callbacks

handle_event(t, map, state)

@callback handle_event(String.t(), map(), state :: term()) ::
  {:noreply, new_state}
  | {:noreply, new_state,
     timeout() | :hibernate | {:continue, continue_arg :: term()}}
  | {:stop, reason :: term(), new_state}
when new_state: term()

Invoked when routing an Extension event

Behaves the same as GenServer.handle_info/2

Functions

attach(extension)

@spec attach(String.t() | [String.t()] | :all) :: :ok

Attach specified extensions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

detach(extension)

@spec detach(String.t() | [String.t()] | :all) :: :ok

Detach specified extensions

Also supports :all as an argument for cases NervesHubLink may want to detach all of them at once

handle_event(event, message)

list()

@spec list() :: [
  %{
    required(String.t()) => %{
      attached?: boolean(),
      attach_ref: String.t(),
      module: module(),
      version: boolean()
    }
  }
]

List extensions currently available

start_link(opts \\ [])