ExMemvid.RetrieverSupervisor (ex_memvid v0.1.2)
A DynamicSupervisor for managing ExMemvid.Retriever processes.
This supervisor allows starting multiple retriever instances dynamically, each with their own video and index paths. It provides a management API similar to the EncoderSupervisor for consistent usage patterns.
Summary
Functions
Returns a specification to start this module under a supervisor.
Returns the count of active retriever processes.
Retrieves information about a specific retriever process.
Lists all active retriever processes managed by this supervisor.
Starts the RetrieverSupervisor.
Starts a new retriever process under this supervisor.
Stops all retriever processes managed by this supervisor.
Stops a retriever process.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Returns the count of active retriever processes.
Examples
iex> ExMemvid.RetrieverSupervisor.count_retrievers()
2
Retrieves information about a specific retriever process.
Parameters
retriever_pid
- PID or registered name of the retriever
Returns
{:ok, info}
where info contains the retriever's state information{:error, :not_found}
if the retriever doesn't exist
Examples
iex> ExMemvid.RetrieverSupervisor.get_retriever_info(pid)
{:ok, %{video_path: "video.mp4", index_path: "index.hnsw", ...}}
Lists all active retriever processes managed by this supervisor.
Returns a list of tuples containing the PID and child specification.
Examples
iex> ExMemvid.RetrieverSupervisor.list_retrievers()
[{#PID<0.123.0>, %{id: #Reference<...>, ...}}]
Starts the RetrieverSupervisor.
Starts a new retriever process under this supervisor.
Parameters
video_path
- Path to the video fileindex_path
- Path to the index fileconfig
- Configuration map for the retrieveropts
- Optional keyword list with::name
- Name to register the retriever process (optional)
Examples
iex> ExMemvid.RetrieverSupervisor.start_retriever("video.mp4", "index.hnsw", %{})
{:ok, #PID<0.123.0>}
iex> ExMemvid.RetrieverSupervisor.start_retriever("video.mp4", "index.hnsw", %{}, name: MyRetriever)
{:ok, #PID<0.124.0>}
Stops all retriever processes managed by this supervisor.
Examples
iex> ExMemvid.RetrieverSupervisor.stop_all_retrievers()
:ok
Stops a retriever process.
Parameters
retriever_pid
- PID or registered name of the retriever to stop
Examples
iex> ExMemvid.RetrieverSupervisor.stop_retriever(retriever_pid)
:ok
iex> ExMemvid.RetrieverSupervisor.stop_retriever(MyRetriever)
:ok