Supervised asynchronous preparation and ownership of a reusable profile runtime.
Add the preparer to an application supervision tree, then query status/1
or call await/2 before accepting work which requires the model-backed
profile. The process prepares exactly once and retains the runtime for reuse.
status/1 exposes the latest report-safe preparation event while large model
assets download or load. Download authorization and offline behavior come
from the :prepare_options passed to start_link/1.
Summary
Functions
Waits for preparation and returns the reusable runtime or diagnostic.
Returns a specification to start this module under a supervisor.
Returns the reusable runtime when preparation is complete.
Starts a supervised profile preparer.
Returns readiness and the latest safe progress event.
Subscribes the caller to progress and completion messages.
Types
@type server() :: GenServer.server()
@type status() :: :preparing | :ready | :failed
Functions
@spec await(server(), timeout()) :: {:ok, Obscura.Profile.Runtime.t()} | {:error, Obscura.Diagnostic.t()}
Waits for preparation and returns the reusable runtime or diagnostic.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec runtime(server()) :: {:ok, Obscura.Profile.Runtime.t()} | {:error, :not_ready | Obscura.Diagnostic.t()}
Returns the reusable runtime when preparation is complete.
@spec start_link(keyword()) :: GenServer.on_start()
Starts a supervised profile preparer.
Returns readiness and the latest safe progress event.
@spec subscribe(server()) :: :ok
Subscribes the caller to progress and completion messages.