Permalink
Browse files

Added gproc:give_away/2 and introduced eunit tests for gproc_dist

EUnit tests have been moved out of the gproc and gproc_dist modules,
and put into the test/ directory.

The contents of README.md have been moved to doc/overview.edoc, and
edown is instructed to automatically update the top-level README.md.

Abecciu's gen_leader added to the rebar dependency list.
  • Loading branch information...
1 parent 0b9d80c commit 2393bf45ee5fb1a1c9a6f93537d1ad31d3f4335f Ulf Wiger committed Apr 3, 2011
Showing with 869 additions and 426 deletions.
  1. +81 −11 README.md
  2. +51 −18 doc/README.md
  3. +90 −164 doc/gproc.md
  4. +3 −6 doc/gproc_app.md
  5. +36 −39 doc/gproc_dist.md
  6. +5 −4 doc/gproc_init.md
  7. +1 −3 doc/gproc_lib.md
  8. +2 −5 doc/gproc_sup.md
  9. +41 −19 doc/overview.edoc
  10. +4 −1 rebar.config
  11. +149 −147 src/gproc_dist.erl
  12. +7 −9 src/gproc_init.erl
  13. +173 −0 test/gproc_dist_tests.erl
  14. +226 −0 test/gproc_tests.erl
View
@@ -1,25 +1,95 @@
-Gproc - Extended Process Dictionary for Erlang
-==============================================
+
+
+<h1>The gproc application</h1>
+
+The gproc application
+=====================
+Extended process dictionary.
+
+__Authors:__ Ulf Wiger ([`ulf.wiger@erlang-solutions.com`](mailto:ulf.wiger@erlang-solutions.com)), Joseph Wayne Norton ([`norton@geminimobile.com`](mailto:norton@geminimobile.com)).
+
+Extended process dictionary
+
+
+
+<h3><a name="Introduction">Introduction</a></h3>
+
+
+
+
Gproc is a process dictionary for Erlang, which provides a number of useful features beyond what the built-in dictionary has:
+
* Use any term as a process alias
+
* Register a process under several aliases
+
* Non-unique properties can be registered simultaneously by many processes
+
* QLC and match specification interface for efficient queries on the
dictionary
+
* Await registration, let's you wait until a process registers itself
+
+* Atomically give away registered names and properties to another process
+
* Counters, and aggregated counters, which automatically maintain the
- total of all counters with a given name.
-* Global registry, with all the above functions applied to a network of nodes.
+ total of all counters with a given name
+
+* Global registry, with all the above functions applied to a network of nodes
+
+
+
+
+
+An interesting application of gproc is building publish/subscribe patterns.
+Example:
+
+<pre>
+subscribe(EventType) -&gt;
+ %% Gproc notation: {p, l, Name} means {(p)roperty, (l)ocal, Name}
+ gproc:reg({p, l, {?MODULE, EventType}}).
+
+notify(EventType, Msg) -&gt;
+ Key = {?MODULE, EventType},
+ gproc:send({p, l, Key}, {self(), Key, Msg}).
+</pre>
+
+
+
+Gproc has a QuickCheck test suite, covering a fairly large part of the local
+gproc functionality, although none of the global registry. It requires a
+commercial EQC license, but rebar is smart enough to detect whether EQC is
+available, and if it isn't, the code in gproc_eqc.erl will be "defined away".
+
+
+
+There is also an eunit suite, covering the basic operations for local and
+global gproc.
+
+
+
+<h3><a name="Building_Edoc">Building Edoc</a></h3>
+
+
+
+
+By default, `./rebar doc` generates Github-flavored Markdown files.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
+Freiburg 2007 ([Paper available here](http://github.com/esl/gproc/blob/master/doc/erlang07-wiger.pdf)).
+
+
+<h2 class="indextitle">Modules</h2>
-Gproc has a QuickCheck test suite, covering a fairly large part of the local gproc functionality, although none of the global registry. It requires a commercial EQC license, but rebar is smart enough to detect whether EQC is available, and if it isn't, the code in gproc_eqc.erl will be "defined away".
-There is also an eunit suite in gproc.erl, but it covers only some of the most basic functions (local only). Lots more tests need to be written... some day. Contributions are most welcome.
-Building Edoc
-=============
-By default, `./rebar doc` generates Github-flavored Markdown files.
-If you want to change this, remove this line from `rebar.config`.
+<table width="100%" border="0" summary="list of modules">
+<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc.md" class="module">gproc</a></td></tr>
+<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_app.md" class="module">gproc_app</a></td></tr>
+<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_dist.md" class="module">gproc_dist</a></td></tr>
+<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_init.md" class="module">gproc_init</a></td></tr>
+<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_lib.md" class="module">gproc_lib</a></td></tr>
+<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_sup.md" class="module">gproc_sup</a></td></tr></table>
-`{edoc_opts, [{doclet, edown_doclet}]}.`
View
@@ -4,48 +4,81 @@
The gproc application
=====================
+Extended process dictionary.
+
+__Authors:__ Ulf Wiger ([`ulf.wiger@erlang-solutions.com`](mailto:ulf.wiger@erlang-solutions.com)), Joseph Wayne Norton ([`norton@geminimobile.com`](mailto:norton@geminimobile.com)).
+
Extended process dictionary
-<h2>Introduction</h2>
-.
+<h3><a name="Introduction">Introduction</a></h3>
-__Authors:__ Ulf Wiger ([`ulf.wiger@erlang-consulting.com`](mailto:ulf.wiger@erlang-consulting.com)), Joseph Wayne Norton ([`norton@geminimobile.com`](mailto:norton@geminimobile.com)).Extended process dictionary
-<h2>Introduction</h2>
+Gproc is a process dictionary for Erlang, which provides a number of useful features beyond what the built-in dictionary has:
+* Use any term as a process alias
+
+* Register a process under several aliases
+
+* Non-unique properties can be registered simultaneously by many processes
+
+* QLC and match specification interface for efficient queries on the
+ dictionary
+
+* Await registration, let's you wait until a process registers itself
+
+* Atomically give away registered names and properties to another process
+
+* Counters, and aggregated counters, which automatically maintain the
+ total of all counters with a given name
+
+* Global registry, with all the above functions applied to a network of nodes
-Gproc was first introduced at the ACM SIGPLAN Erlang Workshop in
-Freiburg 2007 ([Paper available here](erlang07-wiger.pdf)).
-This application was designed to meet the following requirements:
+An interesting application of gproc is building publish/subscribe patterns.
+Example:
+<pre>
+subscribe(EventType) -&gt;
+ %% Gproc notation: {p, l, Name} means {(p)roperty, (l)ocal, Name}
+ gproc:reg({p, l, {?MODULE, EventType}}).
+notify(EventType, Msg) -&gt;
+ Key = {?MODULE, EventType},
+ gproc:send({p, l, Key}, {self(), Key, Msg}).
+</pre>
-<li>
-A process can register itself using any term.
-A process can register more than one name
-A process can publish non-unique {Key,Value} 'properties'
-The registry must be efficiently searchable
-</li>
+Gproc has a QuickCheck test suite, covering a fairly large part of the local
+gproc functionality, although none of the global registry. It requires a
+commercial EQC license, but rebar is smart enough to detect whether EQC is
+available, and if it isn't, the code in gproc_eqc.erl will be "defined away".
-As additional features, the registry was designed to allow global
-registration, and a special {Key,Value} property called a counter.
-It is also possible to create an 'aggregate counter', which will
-continuously reflect the sum of all counters with the same name.
-_In its current state, the global registration facility is brokenand should not be used. It will be migrated over to a new version of gen_leader. This work will be done with low priority unless peopleexpress a strong urge to use this functionality._
+There is also an eunit suite, covering the basic operations for local and
+global gproc.
+
+
+
+<h3><a name="Building_Edoc">Building Edoc</a></h3>
+
+
+
+
+By default, `./rebar doc` generates Github-flavored Markdown files.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
+Freiburg 2007 ([Paper available here](erlang07-wiger.pdf)).
<h2 class="indextitle">Modules</h2>
Oops, something went wrong. Retry.

0 comments on commit 2393bf4

Please sign in to comment.