[erlang-questions] gen behaviors and global groups

Serge Aleynikov saleyn@REDACTED
Sun Aug 24 03:52:14 CEST 2008


Currently when using gen_* behaviors the way to reference a 
locally/globally registered server is by providing a server name in the 
form:

	ServerName = {local,Name} | {global,GlobalName}

When the cluster of nodes is partitioned into global groups, there 
doesn't seem to be a way to instruct a server to do a global name lookup 
in a specific global group.  Unless I am missing something, it looks 
like the gen behaviors should allow this types of server names:

	ServerName = {local,Name} | {global,GlobalName} |
                      {{group, Group}, GlobalName}

Without this third option one would have to do something like this in 
order to call a server registered in group G:

my_function(Name, Args) ->
     Group = {group, G},
     case global_group:whereis_name(Group, Name) of
     Pid when is_pid(Pid) ->
	gen_server:call(Pid, {my_function, Args});
     undefined ->
	{error, noproc}
     end.

Shouldn't gen.erl handle this sort of name lookups automatically?

Serge



More information about the erlang-questions mailing list