Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 102 lines (60 sloc) 4.178 kB
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
1
2
b5c9cd2 @uwiger resolve race in gproc:await/2
authored
3 #The gproc application#
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
4
5
6 __Authors:__ Ulf Wiger ([`ulf.wiger@erlang-solutions.com`](mailto:ulf.wiger@erlang-solutions.com)), Joseph Wayne Norton ([`norton@geminimobile.com`](mailto:norton@geminimobile.com)).
7
8 Extended process dictionary
9
b5c9cd2 @uwiger resolve race in gproc:await/2
authored
10 ##Introduction##
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
11
12
98ba2d9 added rebar support
Ulf Wiger authored
13 Gproc is a process dictionary for Erlang, which provides a number of useful features beyond what the built-in dictionary has:
14 * Use any term as a process alias
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
15
98ba2d9 added rebar support
Ulf Wiger authored
16 * Register a process under several aliases
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
17
98ba2d9 added rebar support
Ulf Wiger authored
18 * Non-unique properties can be registered simultaneously by many processes
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
19
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
20 * QLC and match specification interface for efficient queries on the
98ba2d9 added rebar support
Ulf Wiger authored
21 dictionary
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
22
98ba2d9 added rebar support
Ulf Wiger authored
23 * Await registration, let's you wait until a process registers itself
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
24
25 * Atomically give away registered names and properties to another process
26
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
27 * Counters, and aggregated counters, which automatically maintain the
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
28 total of all counters with a given name
29
30 * Global registry, with all the above functions applied to a network of nodes
31
32
33
b5c9cd2 @uwiger resolve race in gproc:await/2
authored
34 ###Use case: System inspection##
af14ad2 doc additions, inherit by name, init_arg
Ulf Wiger authored
35
36
37 Gproc was designed to work as a central index for "process metadata", i.e.
38 properties that describe the role and characteristics of each process. Having
39 a single registry that is flexible enough to hold important types of property
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
40 makes it easier to (a) find processes of a certain type, and (b) query and
af14ad2 doc additions, inherit by name, init_arg
Ulf Wiger authored
41 browse key data in a running system.
42
b5c9cd2 @uwiger resolve race in gproc:await/2
authored
43 ###Use case: Pub/Sub patterns##
af14ad2 doc additions, inherit by name, init_arg
Ulf Wiger authored
44
45
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
46 An interesting application of gproc is building publish/subscribe patterns.
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
47 Example:<pre>
59365c4 Fixed select/qlc scope (default: all); fixed dist eunit test; new rebar
Ulf Wiger authored
48 subscribe(EventType) ->
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
49 %% Gproc notation: {p, l, Name} means {(p)roperty, (l)ocal, Name}
50 gproc:reg({p, l, {?MODULE, EventType}}).
51
59365c4 Fixed select/qlc scope (default: all); fixed dist eunit test; new rebar
Ulf Wiger authored
52 notify(EventType, Msg) ->
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
53 Key = {?MODULE, EventType},
54 gproc:send({p, l, Key}, {self(), Key, Msg}).
55 </pre>
56
b5c9cd2 @uwiger resolve race in gproc:await/2
authored
57 ###Use case: Environment handling##
af14ad2 doc additions, inherit by name, init_arg
Ulf Wiger authored
58
59
60 Gproc provides a set of functions to read environment variables, possibly from
61 alternative sources, and cache them for efficient lookup. Caching also provides
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
62 a way to see which processes rely on certain configuration values, as well as
63 which values they actually ended up using.
af14ad2 doc additions, inherit by name, init_arg
Ulf Wiger authored
64
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
65 See [`gproc:get_env/4`](http://github.com/esl/gproc/blob/master/doc/gproc.md#get_env-4), [`gproc:get_set_env/4`](http://github.com/esl/gproc/blob/master/doc/gproc.md#get_set_env-4) and
781e0d0 norton chgs merged, version 0.2.11
Ulf Wiger authored
66 [`gproc:set_env/5`](http://github.com/esl/gproc/blob/master/doc/gproc.md#set_env-5) for details.
af14ad2 doc additions, inherit by name, init_arg
Ulf Wiger authored
67
b5c9cd2 @uwiger resolve race in gproc:await/2
authored
68 ##Testing##
af14ad2 doc additions, inherit by name, init_arg
Ulf Wiger authored
69
70
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
71 Gproc has a QuickCheck test suite, covering a fairly large part of the local
72 gproc functionality, although none of the global registry. It requires a
73 commercial EQC license, but rebar is smart enough to detect whether EQC is
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
74 available, and if it isn't, the code in gproc_eqc.erl will be "defined away".
75
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
76 There is also an eunit suite, covering the basic operations for local and
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
77 global gproc.
78
b5c9cd2 @uwiger resolve race in gproc:await/2
authored
79 ##Building Edoc##
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
80
81
82
efeaf8b @uwiger documentation fixes (esp gproc:select/[1,2])
authored
83 By default, `./rebar doc` generates Github-flavored Markdown files.
84 If you want to change this, remove the `edoc_opts` line from `rebar.config`.Gproc was first introduced at the ACM SIGPLAN Erlang Workshop in
781e0d0 norton chgs merged, version 0.2.11
Ulf Wiger authored
85 Freiburg 2007 ([Paper available here](http://github.com/esl/gproc/blob/master/doc/erlang07-wiger.pdf)).
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
86
87
b5c9cd2 @uwiger resolve race in gproc:await/2
authored
88 ##Modules##
98ba2d9 added rebar support
Ulf Wiger authored
89
1cb3c92 added words about building docs
Ulf Wiger authored
90
2393bf4 Added gproc:give_away/2 and introduced eunit tests for gproc_dist
Ulf Wiger authored
91 <table width="100%" border="0" summary="list of modules">
781e0d0 norton chgs merged, version 0.2.11
Ulf Wiger authored
92 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc.md" class="module">gproc</a></td></tr>
93 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_app.md" class="module">gproc_app</a></td></tr>
94 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_dist.md" class="module">gproc_dist</a></td></tr>
b1589f6 Add gproc:i()
Ulf Wiger authored
95 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_info.md" class="module">gproc_info</a></td></tr>
781e0d0 norton chgs merged, version 0.2.11
Ulf Wiger authored
96 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_init.md" class="module">gproc_init</a></td></tr>
97 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_lib.md" class="module">gproc_lib</a></td></tr>
a8297b2 gproc_monitor, local only, no test cases
Ulf Wiger authored
98 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_monitor.md" class="module">gproc_monitor</a></td></tr>
1740e41 @uwiger Fix dist update_counter() bug, add gproc_ps module, add update_counte…
authored
99 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_ps.md" class="module">gproc_ps</a></td></tr>
781e0d0 norton chgs merged, version 0.2.11
Ulf Wiger authored
100 <tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_sup.md" class="module">gproc_sup</a></td></tr></table>
1cb3c92 added words about building docs
Ulf Wiger authored
101
Something went wrong with that request. Please try again.