[erlang-patches] new patch: Add plugin support for alternative name lookup
Ahmed Omar
spawn.think@REDACTED
Mon Jan 17 21:17:22 CET 2011
+1 for that, i see it not only as a good option but a good practice to
standardize a common problem i have seen before being solved in different
ways
On Mon, Jan 17, 2011 at 4:12 PM, Ulf Wiger
<ulf.wiger@REDACTED>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 <ulf.wiger@REDACTED>
> 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:erlang-patches-unsubscribe@REDACTED
>
>
--
Best Regards,
- Ahmed Omar
http://nl.linkedin.com/in/adiaa
Follow me on twitter
@spawn_think <http://twitter.com/#!/spawn_think>
More information about the erlang-patches
mailing list