[erlang-questions] conditional pub-sub in gproc
Ulf Wiger
ulf@REDACTED
Sat Jun 16 02:58:33 CEST 2012
Good points.
Please try out the latest version, which includes a few new functions:
gproc:await(Node, Key, Timeout)
https://github.com/esl/gproc/blob/master/doc/gproc.md#await-3
gproc:wide_await(Nodes, Key, Timeout)
https://github.com/esl/gproc/blob/master/doc/gproc.md#wide_await3
gproc:nb_wait(Node, Key)
https://github.com/esl/gproc/blob/master/doc/gproc.md#nb_wait-2
gproc:cancel_wait(Node, Key, Ref)
https://github.com/esl/gproc/blob/master/doc/gproc.md#cancel_wait-3
Note that await/3 also returns the Value, so can be throught of as a
distributed get_value() function.
BR,
Ulf W
On 15 Jun 2012, at 16:25, Loïc Hoguin wrote:
> Sorry I should have been clearer.
>
> I'm using global gproc to locate processes that may be on any node of the cluster. But sometimes I run into gen_leader's issues (for example if a node crashes) so I was wondering if I could manage still using gproc for my purposes without gen_leader.
>
> Currently it's easy to broadcast information to other local gprocs but not so much to retrieve remote data, similar to what get_value/2 or where/1 would do in a distributed context.
>
> It would be nice to be able to have a cluster of local gprocs and easily access them from any remote node, similar to how bcast works for broadcasting.
>
> On 06/16/2012 01:18 AM, Ulf Wiger wrote:
>>
>> On 15 Jun 2012, at 16:10, Loïc Hoguin wrote:
>>
>>> That removes some functionality though, doesn't it. Like :get_value/1 and where/1. How would you suggest using these without global gproc?
>>
>> Uhm, those functions work perfectly fine in a local context…
>>
>> Can you expand on that?
>>
>> Global gproc (gproc_dist) is disabled by default.
>> My assumption is that most people leave it that way.
>>
>> BR,
>> Ulf W
>>
>> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
>> http://feuerlabs.com
>>
>>
>>
>
>
> --
> Loïc Hoguin
> Erlang Cowboy
> Nine Nines
>
>
Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com
More information about the erlang-questions
mailing list