astarte_device v0.11.3 Astarte.Device.InterfaceProvider behaviour

This behaviour is used to implement a flexible way to retrieve interfaces for Astarte.Device.

Link to this section Summary

Callbacks

Initialize the InterfaceProvider and return its state.

Link to this section Types

Link to this type

state()

state() :: %{
  optional(String.t()) => %Astarte.Core.Interface{
    aggregate: term(),
    aggregation: term(),
    description: term(),
    doc: term(),
    interface_id: term(),
    interface_name: term(),
    major_version: term(),
    mappings: term(),
    minor_version: term(),
    name: term(),
    ownership: term(),
    quality: term(),
    type: term(),
    version_major: term(),
    version_minor: term()
  }
}

Link to this section Callbacks

Link to this callback

init(args)

init(args :: term()) ::
  {:ok, state :: Astarte.Device.InterfaceProvider.state()}
  | {:error, reason :: term()}

Initialize the InterfaceProvider and return its state.

The state must be a map with the interface names as keys and the interfaces (as %Astarte.Core.Interface{} structs) as values.

The callback can also return {:error, reason} if its fails.