Foundation (foundation v0.1.0)

Main public API for Foundation layer.

Provides unified access to all Foundation services including configuration, events, telemetry, and error handling. This is the main entry point for interacting with the Foundation layer.

Summary

Functions

Check if all Foundation services are available and ready.

Get comprehensive health information for the Foundation layer.

Initialize the entire Foundation layer.

Shutdown the Foundation layer gracefully.

Start Foundation (alias for initialize/1).

Get the status of all Foundation services.

Get version information for the Foundation layer.

Functions

available?()

@spec available?() :: boolean()

Check if all Foundation services are available and ready.

Examples

iex> Foundation.available?()
true

health()

@spec health() :: {:ok, map()} | {:error, Foundation.Types.Error.t()}

Get comprehensive health information for the Foundation layer.

Returns detailed health and performance metrics for monitoring.

Examples

iex> Foundation.health()
{:ok, %{
  status: :healthy,
  uptime_ms: 3600000,
  services: %{...},
  metrics: %{...}
}}

initialize(opts \\ [])

@spec initialize(keyword()) :: :ok | {:error, Foundation.Types.Error.t()}

Initialize the entire Foundation layer.

Starts all Foundation services in the correct order and ensures they are properly configured and ready for use.

Examples

iex> Foundation.initialize()
:ok

iex> Foundation.initialize(config: [debug_mode: true])
:ok

shutdown()

@spec shutdown() :: :ok

Shutdown the Foundation layer gracefully.

This stops all Foundation services in reverse order and ensures proper cleanup of resources.

Examples

iex> Foundation.shutdown()
:ok

start_link(opts \\ [])

@spec start_link(keyword()) :: {:ok, pid()}

Start Foundation (alias for initialize/1).

status()

@spec status() :: {:ok, map()} | {:error, Foundation.Types.Error.t()}

Get the status of all Foundation services.

Returns a map containing the status of each core service.

Examples

iex> Foundation.status()
{:ok, %{
  config: %{status: :running, uptime_ms: 12345},
  events: %{status: :running, events_count: 1000},
  telemetry: %{status: :running, metrics_count: 50}
}}

version()

@spec version() :: String.t()

Get version information for the Foundation layer.

Examples

iex> Foundation.version()
"0.1.0"