Skip to content

Commit

Permalink
Added attributes, update_counter() on names, gproc_pool
Browse files Browse the repository at this point in the history
  • Loading branch information
uwiger committed Jun 3, 2013
1 parent 81ff4ce commit 05cd9f8
Show file tree
Hide file tree
Showing 20 changed files with 2,969 additions and 681 deletions.
35 changes: 20 additions & 15 deletions README.md
@@ -1,28 +1,28 @@


#The gproc application#

# The gproc application #

__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

##Note##

## Note ##

Gproc has two dependencies: `gen_leader` and `edown`. Since most people don't
actively use either, they are no longer fetched by default.

* To enable fetching of `gen_leader`, export the OS environment variable`GPROC_DIST=true` (this can be done e.g. from a GNU Makefile)

* `edown` is fetched on-demand whenver `rebar get-deps doc` is called (which
happens when you call `make doc`)



##Introduction##

## Introduction ##

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
Expand All @@ -43,31 +43,34 @@ Gproc is a process dictionary for Erlang, which provides a number of useful feat



###Use case: System inspection##

### Use case: System inspection ###

Gproc was designed to work as a central index for "process metadata", i.e.
properties that describe the role and characteristics of each process. Having
a single registry that is flexible enough to hold important types of property
makes it easier to (a) find processes of a certain type, and (b) query and
browse key data in a running system.

###Use case: Pub/Sub patterns##

### Use case: Pub/Sub patterns ###

An interesting application of gproc is building publish/subscribe patterns.
Example:<pre>
Example:

```erlang

subscribe(EventType) ->
%% Gproc notation: {p, l, Name} means {(p)roperty, (l)ocal, Name}
gproc:reg({p, l, {?MODULE, EventType}}).

notify(EventType, Msg) ->
Key = {?MODULE, EventType},
gproc:send({p, l, Key}, {self(), Key, Msg}).
</pre>

###Use case: Environment handling##
```


### Use case: Environment handling ###

Gproc provides a set of functions to read environment variables, possibly from
alternative sources, and cache them for efficient lookup. Caching also provides
Expand All @@ -77,8 +80,8 @@ which values they actually ended up using.
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
[`gproc:set_env/5`](http://github.com/esl/gproc/blob/master/doc/gproc.md#set_env-5) for details.

##Testing##

## Testing ##

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
Expand All @@ -88,16 +91,17 @@ 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.

##Building Edoc##

## Building Edoc ##


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
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)).


##Modules##
## Modules ##


<table width="100%" border="0" summary="list of modules">
Expand All @@ -109,6 +113,7 @@ Freiburg 2007 ([Paper available here](http://github.com/esl/gproc/blob/master/do
<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_monitor.md" class="module">gproc_monitor</a></td></tr>
<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_pool.md" class="module">gproc_pool</a></td></tr>
<tr><td><a href="http://github.com/esl/gproc/blob/master/doc/gproc_ps.md" class="module">gproc_ps</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>

35 changes: 20 additions & 15 deletions doc/README.md
@@ -1,28 +1,28 @@


#The gproc application#

# The gproc application #

__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

##Note##

## Note ##

Gproc has two dependencies: `gen_leader` and `edown`. Since most people don't
actively use either, they are no longer fetched by default.

* To enable fetching of `gen_leader`, export the OS environment variable`GPROC_DIST=true` (this can be done e.g. from a GNU Makefile)

* `edown` is fetched on-demand whenver `rebar get-deps doc` is called (which
happens when you call `make doc`)



##Introduction##

## Introduction ##

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
Expand All @@ -43,31 +43,34 @@ Gproc is a process dictionary for Erlang, which provides a number of useful feat



###Use case: System inspection##

### Use case: System inspection ###

Gproc was designed to work as a central index for "process metadata", i.e.
properties that describe the role and characteristics of each process. Having
a single registry that is flexible enough to hold important types of property
makes it easier to (a) find processes of a certain type, and (b) query and
browse key data in a running system.

###Use case: Pub/Sub patterns##

### Use case: Pub/Sub patterns ###

An interesting application of gproc is building publish/subscribe patterns.
Example:<pre>
Example:

```erlang

subscribe(EventType) ->
%% Gproc notation: {p, l, Name} means {(p)roperty, (l)ocal, Name}
gproc:reg({p, l, {?MODULE, EventType}}).

notify(EventType, Msg) ->
Key = {?MODULE, EventType},
gproc:send({p, l, Key}, {self(), Key, Msg}).
</pre>

###Use case: Environment handling##
```


### Use case: Environment handling ###

Gproc provides a set of functions to read environment variables, possibly from
alternative sources, and cache them for efficient lookup. Caching also provides
Expand All @@ -77,8 +80,8 @@ which values they actually ended up using.
See [`gproc:get_env/4`](gproc.md#get_env-4), [`gproc:get_set_env/4`](gproc.md#get_set_env-4) and
[`gproc:set_env/5`](gproc.md#set_env-5) for details.

##Testing##

## Testing ##

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
Expand All @@ -88,16 +91,17 @@ 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.

##Building Edoc##

## Building Edoc ##


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
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)).


##Modules##
## Modules ##


<table width="100%" border="0" summary="list of modules">
Expand All @@ -109,6 +113,7 @@ Freiburg 2007 ([Paper available here](erlang07-wiger.pdf)).
<tr><td><a href="gproc_init.md" class="module">gproc_init</a></td></tr>
<tr><td><a href="gproc_lib.md" class="module">gproc_lib</a></td></tr>
<tr><td><a href="gproc_monitor.md" class="module">gproc_monitor</a></td></tr>
<tr><td><a href="gproc_pool.md" class="module">gproc_pool</a></td></tr>
<tr><td><a href="gproc_ps.md" class="module">gproc_ps</a></td></tr>
<tr><td><a href="gproc_sup.md" class="module">gproc_sup</a></td></tr></table>

2 changes: 1 addition & 1 deletion doc/edoc-info
@@ -1,4 +1,4 @@
{application,gproc}.
{packages,[]}.
{modules,[gproc,gproc_app,gproc_bcast,gproc_dist,gproc_info,gproc_init,
gproc_lib,gproc_monitor,gproc_ps,gproc_sup]}.
gproc_lib,gproc_monitor,gproc_pool,gproc_ps,gproc_sup]}.

0 comments on commit 05cd9f8

Please sign in to comment.