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

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

count_retrievers()

Returns the count of active retriever processes.

Examples

iex> ExMemvid.RetrieverSupervisor.count_retrievers()
2

get_retriever_info(retriever_pid)

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", ...}}

list_retrievers()

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<...>, ...}}]

start_link(init_arg)

Starts the RetrieverSupervisor.

start_retriever(video_path, index_path, config, opts \\ [])

Starts a new retriever process under this supervisor.

Parameters

  • video_path - Path to the video file
  • index_path - Path to the index file
  • config - Configuration map for the retriever
  • opts - 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>}

stop_all_retrievers()

Stops all retriever processes managed by this supervisor.

Examples

iex> ExMemvid.RetrieverSupervisor.stop_all_retrievers()
:ok

stop_retriever(retriever_pid)

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