Dynamic supervisor for user-spawned workers in SuperCache.
This module provides a DynamicSupervisor that allows runtime creation
and management of child processes. It is primarily used for starting
buffer streams and other dynamically allocated resources.
Example
# Start a single worker
{:ok, pid} = SuperCache.Sup.start_worker({MyWorker, []})
# Start multiple workers
workers = [{Worker1, []}, {Worker2, []}]
results = SuperCache.Sup.start_workers(workers)
Summary
Functions
Returns a specification to start this module under a supervisor.
Starts the dynamic supervisor linked to the current process.
Starts a single child specification under this supervisor.
Starts a list of child specifications under this supervisor.
Terminates a child process identified by pid or name.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Starts the dynamic supervisor linked to the current process.
The supervisor is registered under the name SuperCache.Sup.
@spec start_worker(Supervisor.child_spec() | {module(), term()} | module()) :: {:ok, pid()} | {:error, term()}
Starts a single child specification under this supervisor.
Returns {:ok, pid} on success or {:error, reason} on failure.
@spec start_workers([Supervisor.child_spec() | {module(), term()} | module()]) :: [ ok: pid(), error: term() ]
Starts a list of child specifications under this supervisor.
Returns a list of {:ok, pid} or {:error, reason} tuples corresponding
to each child specification.
Examples
SuperCache.Sup.start_workers([{MyWorker, arg1}, {OtherWorker, arg2}])
# => [{:ok, #PID<0.100.0>}, {:ok, #PID<0.101.0>}]
Terminates a child process identified by pid or name.