erllama_model_sup (erllama v0.1.0)

View Source

Dynamic supervisor for erllama_model gen_statems. Each loaded model is one child started via start_model/2. simple_one_for_one strategy: children are spawned on demand from a single child spec.

Summary

Functions

List currently-supervised model pids (raw supervisor view).

Start a model under this supervisor. ModelId is a binary; the model registers itself in erllama_registry under that key. Returns the started pid.

Terminate a previously started model.

Functions

init/1

models()

-spec models() -> [{undefined, pid(), worker, [module()]}].

List currently-supervised model pids (raw supervisor view).

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.

start_model(ModelId, Config)

-spec start_model(binary(), map()) -> {ok, pid()} | {error, term()}.

Start a model under this supervisor. ModelId is a binary; the model registers itself in erllama_registry under that key. Returns the started pid.

stop_model(ModelOrPid)

-spec stop_model(binary() | pid()) -> ok | {error, term()}.

Terminate a previously started model.