[erlang-patches] new patch: Add plugin support for alternative name lookup

Serge Aleynikov <>
Tue Jan 18 00:58:28 CET 2011


Ulf,

Good idea.  At some point I too was running into limitations of current 
registration options:

http://www.erlang.org/pipermail/erlang-questions/2008-August/037604.html

Your approach is more flexible than the patch/solution discussed in that 
thread.  Though it doesn't negate the need for {global_group, Name}, and 
{global_group, Where, Name}, which would natively map to the concept of 
global groups supported by the distribution, the later can be easily 
implemented using your method.

+1.

On 1/17/2011 10:12 AM, Ulf Wiger wrote:
>
> git fetch git://github.com/uwiger/otp.git uw_extending_gen
>
> Note that I've not updated documentation. If people don't
> like the idea, I won't waste my time doing so, but otherwise, I
> will follow up with documentation changes as well.
>
> BR,
> Ulf
>
>
> commit 22453671179dadf7204675438cf36edde137f945
> Author: Ulf Wiger<>
> Date:   Mon Jan 17 15:47:00 2011 +0100
>
>      Add plugin support for alternative name lookup
>
>      OTP behaviour instances (gen_server, gen_fsm, gen_event) can currently
>      register themselves either locally or globally, and the behaviour
>      libraries (including gen.erl) support both addressing methods, as well
>      as the normal Pid and {Name, Node}.
>
>      However, there are alternative registry implementations - e.g. gproc -
>      and one can well imagine other ways of locating a behaviour instance,
>      e.g. on a node connected only via a TCP tunnel, rather than via
>      Distributed Erlang. In all these cases, one needs to write extra code
>      to identify the behaviour instance, even though the instance itself
>      need not be aware of how it is located.
>
>      This patch introduces a new way of locating a behaviour instance:
>      {via, Module, Name}.
>
>      Module is expected to export a subset of the functions in global.erl,
>      namely:
>
>      register_name(Name, Pid) ->  yes | no
>      whereis_name(Name)  ->  pid() | undefined
>      unregister_name(Name) ->  ok
>      send(Name, Msg) ->  Pid
>
>      Semantics are expected to be the same as for global.erl
>
>      This can be used in all places where {global, Name} is accepted.
>
>      In this patch, the test suites gen_server_SUITE, gen_fsm_SUITE and
>      gen_event_SUITE have been extended, but documentation has not been
>      updated. This will be done if there is agreement that the idea is
>      good.
>
>
> Ulf Wiger, CTO, Erlang Solutions, Ltd.
> http://erlang-solutions.com
>
>
>
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>


More information about the erlang-patches mailing list