Lightning behaviour (Lightning v2.13.3)

View Source

Lightning keeps the contexts that define your domain and business logic.

Contexts are also responsible for managing your data, regardless if it comes from the database, an external API or others.

Summary

Types

release_info()

@type release_info() :: %{
  label: String.t() | nil,
  commit: String.t() | nil,
  image_tag: String.t() | nil,
  branch: String.t() | nil,
  vsn: String.t()
}

Callbacks

broadcast(binary, {})

@callback broadcast(
  binary(),
  {atom(), any()}
) :: :ok | {:error, term()}

current_time()

@callback current_time() :: DateTime.t()

local_broadcast(binary, {})

@callback local_broadcast(
  binary(),
  {atom(), any()}
) :: :ok | {:error, term()}

release()

@callback release() :: release_info()

subscribe(binary)

@callback subscribe(binary()) :: :ok | {:error, term()}

Functions

broadcast(topic, msg)

current_time()

Returns the current time at UTC.

local_broadcast(topic, msg)

release()

@spec release() :: release_info()

subscribe(topic)