Paxtor.Helpers (paxtor v0.3.0)

Summary

Functions

When a start_link or Supervisor.start_child is called, it can return different kind of answers. The happy path is usually {:ok, pid} or {:ok, pid, info}, so we can grab the pid from these cases. Also when a start_child is called and the supervisor already has a child with the given id, it returns {:error, {:already_started, pid}}, and we strill can get a pid. But in the error cases, like in case of an :ignore or {:error, reason} value, there's no pid. This function pattern matches and returns the pid from the positive cases.

Functions

pid_from(arg1)

When a start_link or Supervisor.start_child is called, it can return different kind of answers. The happy path is usually {:ok, pid} or {:ok, pid, info}, so we can grab the pid from these cases. Also when a start_child is called and the supervisor already has a child with the given id, it returns {:error, {:already_started, pid}}, and we strill can get a pid. But in the error cases, like in case of an :ignore or {:error, reason} value, there's no pid. This function pattern matches and returns the pid from the positive cases.

start_children(child_spec, supervisor, opts \\ [])