Parent.Client (parent v0.12.1) View Source
Functions for interacting with parent's children from other processes.
All of these functions issue a call to the parent process. Therefore, they can't be used from
inside the parent process. Use functions from the Parent
module instead to interact with the
children from within the process.
Likewise these functions can't be invoked inside the child process during its initialization.
Defer interacting with the parent to GenServer.handle_continue/2
, or if you're using another
behaviour which doesn't support such callback, send yourself a message to safely do the post-init
interaction with the parent.
If parent is configured with the registry?: true
option, some query functions, such as
child_pid/2
will perform an ETS lookup instead of issuing a call, so the caveats above won't
apply.
Link to this section Summary
Functions
Client interface to Parent.child_meta/1
.
Client interface to Parent.child_pid/1
.
Client interface to Parent.children/0
.
Client interface to Parent.restart_child/1
.
Client interface to Parent.return_children/1
.
Client interface to Parent.shutdown_all/1
.
Client interface to Parent.shutdown_child/1
.
Client interface to Parent.start_child/2
.
Client interface to Parent.update_child_meta/2
.
Link to this section Functions
Specs
child_meta(GenServer.server(), Parent.child_ref()) :: {:ok, Parent.child_meta()} | :error
Client interface to Parent.child_meta/1
.
If the parent is a registry, the result will be obtained from the ETS table.
Specs
child_pid(GenServer.server(), Parent.child_id()) :: {:ok, pid()} | :error
Client interface to Parent.child_pid/1
.
If the parent is a registry, the result will be obtained from the ETS table.
Specs
children(GenServer.server()) :: [Parent.child()]
Client interface to Parent.children/0
.
If the parent is a registry, the result will be obtained from the ETS table.
Specs
restart_child(GenServer.server(), Parent.child_ref()) :: :ok | :error
Client interface to Parent.restart_child/1
.
Specs
return_children(GenServer.server(), Parent.stopped_children()) :: :ok
Client interface to Parent.return_children/1
.
Specs
shutdown_all(GenServer.server(), any()) :: Parent.stopped_children()
Client interface to Parent.shutdown_all/1
.
Specs
shutdown_child(GenServer.server(), Parent.child_ref()) :: {:ok, Parent.stopped_children()} | :error
Client interface to Parent.shutdown_child/1
.
Specs
start_child(GenServer.server(), Parent.start_spec(), Keyword.t()) :: Parent.on_start_child()
Client interface to Parent.start_child/2
.
Specs
update_child_meta( GenServer.server(), Parent.child_id(), (Parent.child_meta() -> Parent.child_meta()) ) :: :ok | :error
Client interface to Parent.update_child_meta/2
.