system_registry v0.6.1 SystemRegistry.Task

Creates a process that executes a function anytime the contents of a given system_registry scope change.

For example, to perform an operation every time that the IPv4 address changes on “wlan0”, do this:

worker(SystemRegistry.Task, [

[:state, :network_interface,  "wlan0", :ipv4_address],
fn({_old, _new}) ->
  # Do something
end])

This technique should be used sparingly and only for performing simple side effects to state change.

Link to this section Summary

Functions

Starts a task as part of a supervision tree

Link to this section Functions

Link to this function start_link(scope, fun, opts \\ [])
start_link(SystemRegistry.scope(), (() -> any()), [term()]) :: {:ok, pid()}

Starts a task as part of a supervision tree.