Candil.Engine.Server (Candil v2.0.0)

Copy Markdown View Source

GenServer that manages a single llama-server OS process.

Each running model occupies one Server process. The server is registered in Candil.Registry under the model alias so callers can look it up by name.

The OS process is started with Port.open/2 and monitored. If the process dies unexpectedly the GenServer terminates, which causes the Registry entry to be removed automatically.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns the Registry module to use for engine registration.

Types

state()

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

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

registry()

@spec registry() :: module()

Returns the Registry module to use for engine registration.

Can be configured via application config:

config :candil, :registry, MyApp.CustomRegistry

Defaults to Candil.Registry.