Candil.Engine.Server.External (Candil v2.1.0)

Copy Markdown View Source

GenServer for engines whose OS process is owned by something else.

This is the Candil-side counterpart of Candil.Engine.Launcher: it holds the base_url and optional pid returned by the launcher, exposes the same :health / :base_url call API as Candil.Engine.Server, polls <base_url>/health every 5 seconds for Candil.Engine.healthy?/1, and — on shutdown — sends :shutdown to the external pid if one was provided.

The process is registered in Candil.Registry under the model alias, so Candil.Engine.stop/1, Candil.Engine.healthy?/1 and Candil.Engine.base_url/1 work uniformly for both local and externally-managed engines.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

state()

@type state() :: %{
  engine: Candil.Engine.t(),
  model: Candil.Model.t(),
  base_url: binary(),
  pid: pid() | nil,
  healthy: boolean()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.