global_group

Grouping Nodes to Global Name Registration Groups

The global group function makes it possible to group the nodes
in a system into partitions, each partition having its own global
name space, refer to global(3). These partitions are
called global groups.

The main advantage of dividing systems to global groups is that
the background load decreases while the number of nodes to be
updated is reduced when manipulating globally registered names.

A GroupTuple without PublishType is the same as a
GroupTuple with PublishType == normal.

group_name() = atom()

publish_type() = hidden | normal

A node started with the command line flag -hidden, see
erl(1), is said to be a
hidden node. A hidden node will establish hidden
connections to nodes not part of the same global group, but
normal (visible) connections to nodes part of the same global
group.

A global group defined with PublishType == hidden, is
said to be a hidden global group. All nodes in a hidden global
group are hidden nodes, regardless if they are started with
the -hidden command line flag or not.

send(Name, Msg) -> pid() | {badarg, {Name, Msg}}

send(Where, Name, Msg) -> pid() | {badarg, {Name, Msg}}

Searches for Name, globally registered on
the specified node or in the specified global group, or --
if the Where argument is not provided -- in any global
group. The global groups are searched in the order in which
they appear in the value of the global_groups
configuration parameter.

If Name is found, the message Msg is sent to
the corresponding pid. The pid is also the return value of
the function. If the name is not found, the function returns
{badarg, {Name, Msg}}.

sync() -> ok

Synchronizes the group nodes, that is, the global name
servers on the group nodes. Also check the names globally
registered in the current global group and unregisters them
on any known node not part of the group.

If synchronization is not possible, an error report is sent
to the error logger (see also error_logger(3)).

whereis_name(Name) -> pid() | undefined

whereis_name(Where, Name) -> pid() | undefined

Searches for Name, globally registered on
the specified node or in the specified global group, or -- if
the Where argument is not provided -- in any global
group. The global groups are searched in the order in which
they appear in the value of the global_groups
configuration parameter.

If Name is found, the corresponding pid is returned.
If the name is not found, the function returns
undefined.

NOTE

In the situation where a node has lost its connections to other
nodes in its global group, but has connections to nodes in other
global groups, a request from another global group may produce an
incorrect or misleading result. For example, the isolated node may
not have accurate information about registered names in its
global group.

Note also that the send/2,3 function is not secure.

Distribution of applications is highly dependent of the global
group definitions. It is not recommended that an application is
distributed over several global groups of the obvious reason that
the registered names may be moved to another global group at
failover/takeover. There is nothing preventing doing this, but
the application code must in such case handle the situation.