View Source Wobserver.Util.Node.Discovery (Wobserver NG v1.14.0)
Helps discovering other nodes to connect to.
The method used can be set in the config file by setting:
config :wobserver,
discovery: :dns,
The following methods can be used: (default: :none
)
:none
, just returns the local node.:dns
, use DNS to search for other nodes. The optiondiscovery_search
needs to be set to filter entries.:custom
, a function as String.
Example config
No discovery: (is default)
config :wobserver,
port: 80,
discovery: :none
Using dns as discovery service:
config :wobserver,
port: 80,
discovery: :dns,
discovery_search: "google.nl"
Using a custom function:
config :wobserver,
port: 80,
discovery: :custom,
discovery_search: &MyApp.CustomDiscovery.discover/0
Using a anonymous function:
config :wobserver,
port: 80,
discovery: :custom,
discovery_search: fn -> [] end
Link to this section Summary
Functions
Discovers other nodes to connect to.
Searches for a node in the discovered nodes.
Retuns the local node.
Link to this section Functions
@spec discover() :: [Wobserver.Util.Node.Remote.t()]
Discovers other nodes to connect to.
The method used can be set in the config file by setting:
config :wobserver,
discovery: :dns,
The following methods can be used: (default: :none
)
:none
, just returns the local node.:dns
, use DNS to search for other nodes. The optiondiscovery_search
needs to be set to filter entries.:custom
, a function as String.
Example config
No discovery: (is default)
config :wobserver,
discovery: :none
Using dns:
config :wobserver,
discovery: :dns,
discovery_search: "google.nl"
Using a custom function:
config :wobserver,
discovery: :custom,
discovery_search: "&MyApp.CustomDiscovery.discover/0"
@spec find(String.t()) :: :local | :unknown | {:remote, Wobserver.Util.Node.Remote.t()}
Searches for a node in the discovered nodes.
The search
will be used to filter through names, hosts and host:port combinations.
The special values for search are:
local
, will always return the local node.
Retuns the local node.