SuperWorker.ConfigLoader.Bootstrap (SuperWorker v0.3.6)

View Source

Bootstraps supervisors from parsed configurations.

This module takes validated and parsed configurations from the Parser module and uses the SuperWorker.Supervisor API to start supervisors and their children.

Summary

Functions

Starts a supervisor with the given parsed configuration.

Functions

start_supervisor(invalid)

@spec start_supervisor(map()) :: {:ok, pid()} | {:error, any()}

Starts a supervisor with the given parsed configuration.

Parameters

  • config - A parsed configuration map containing:
    • :options - Supervisor options (must include :id)
    • :children - List of child specifications

Returns

  • {:ok, pid} - Successfully started supervisor
  • {:error, reason} - Failed to start supervisor

Example

config = %{
  options: [id: :my_sup, num_partitions: 2, link: false],
  children: [
    %{
      type: :group,
      id: :my_group,
      options: [restart_strategy: :one_for_one],
      workers: [
        %{mfa: {MyModule, :worker_fun, []}, options: [id: :worker1]}
      ]
    }
  ]
}

Bootstrap.start_supervisor(config)