View Source ReflectOS.Kernel.Section.Registry (reflect_os_kernel v0.10.0)

Used to register one or more ReflectOS.Kernel.Sections with the system.

If you are building an extension library with a new section type, the section module must be registered with the ReflectOS system. This will ensure that it's available for users to create and configure sections via the Console UI application.

The recommended way to accomplish this is to do so by starting a task in the root supervisor of your application.

For example:

defmodule MyReflectOSExtensions.Application do
  @moduledoc false

  use Application

  alias ReflectOS.Kernel.Section.Registry, as: SectionRegistry

  @impl true
  def start(_type, _args) do
    children = [
      # Start a task to register ReflectOS extensions
      {Task, fn -> reflect_os_register() end}
    ]

    opts = [strategy: :one_for_one, name: MyReflectOSExtensions.Supervisor]
    Supervisor.start_link(children, opts)
  end

  defp reflect_os_register() do
    SectionRegistry.register([
      MyReflectOSExtensions.Sections.MyNewSection,
    ])
  end
end

Summary

Functions

Returns a specification to start this module under a supervisor.

Retrieves a list of definitions for all registered sections.

Retrieves the list of registered section modules.

Registers a module with the Section registry.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec definitions() :: [ReflectOS.Kernel.Section.Definition.t()]

Retrieves a list of definitions for all registered sections.

@spec list() :: [module()]

Retrieves the list of registered section modules.

@spec register(module() | [module()]) :: :ok

Registers a module with the Section registry.

Accepts either a single module or a list of modules.