Astarte.Device.InterfaceProvider behaviour (astarte_device v1.0.5)

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

Specs

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

Specs

init(args :: term()) :: {:ok, state :: 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.