Browse Source

doc fixes + revert to shortnames in dist_tests

Ulf Wiger 14 years ago
parent
commit
f0964667a3
4 changed files with 54 additions and 16 deletions
  1. 36 9
      doc/gproc.md
  2. 1 1
      src/gproc.app.src
  3. 16 5
      src/gproc.erl
  4. 1 1
      test/gproc_dist_tests.erl

+ 36 - 9
doc/gproc.md

@@ -88,19 +88,24 @@ Type and scope for registration and lookup:
 sel_var() = DollarVar | '_'.
 sel_var() = DollarVar | '_'.
 
 
 
 
-<h3 class="typedecl"><a name="type-scope">scope()</a></h3>
+<h3 class="typedecl"><a name="type-reg_id">reg_id()</a></h3>
 
 
 
 
 
 
 
 
-<pre>scope() = l | g</pre>
+<pre>reg_id() = {<a href="#type-type">type()</a>, <a href="#type-scope">scope()</a>, any()}</pre>
 
 
 
 
 
 
+<h3 class="typedecl"><a name="type-scope">scope()</a></h3>
 
 
-l = local registration; g = global registration
 
 
-Type and scope for select(), qlc() and stepping:
+
+
+<pre>scope() = l | g</pre>
+
+
+l = local registration; g = global registration
 
 
 
 
 
 
@@ -142,6 +147,18 @@ Type and scope for select(), qlc() and stepping:
 n = name; p = property; c = counter;
 n = name; p = property; c = counter;
 a = aggregate_counter
 a = aggregate_counter
 
 
+
+<h3 class="typedecl"><a name="type-unique_id">unique_id()</a></h3>
+
+
+
+
+<pre>unique_id() = {n | a, <a href="#type-scope">scope()</a>, any()}</pre>
+
+
+Type and scope for select(), qlc() and stepping:
+
+
 <h2><a name="index">Function Index</a></h2>
 <h2><a name="index">Function Index</a></h2>
 
 
 
 
@@ -361,7 +378,7 @@ Equivalent to [`get_env(Scope, App, Key, [app_env])`](#get_env-4).<a name="get_e
 
 
 
 
 <pre>get_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom(), Strategy) -> term()</pre>
 <pre>get_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom(), Strategy) -> term()</pre>
-<ul class="definitions"><li><pre>Strategy = [Alternative]</pre></li><li><pre>Alternative = app_env | os_env | inherit | {inherit, pid()} | {default, term()} | error</pre></li></ul>
+<ul class="definitions"><li><pre>Strategy = [Alternative]</pre></li><li><pre>Alternative = app_env | os_env | inherit | {inherit, pid()} | {inherit, <a href="#type-unique_id">unique_id()</a>} | init_arg | {mnesia, ActivityType, Oid, Pos} | {default, term()} | error</pre></li></ul>
 
 
 
 
 
 
@@ -384,8 +401,8 @@ uppercase string
 * `{os_env, ENV}` - try `os:getenv(ENV)`
 * `{os_env, ENV}` - try `os:getenv(ENV)`
 * `inherit` - inherit the cached value, if any, held by the (proc_lib) parent.
 * `inherit` - inherit the cached value, if any, held by the (proc_lib) parent.
 * `{inherit, Pid}` - inherit the cached value, if any, held by `Pid`.
 * `{inherit, Pid}` - inherit the cached value, if any, held by `Pid`.
-* `{inherit, Name}` - inherit the cached value, if any, held by the process
-registered in `gproc` as `Name`.
+* `{inherit, Id}` - inherit the cached value, if any, held by the process
+registered in `gproc` as `Id`.
 * `init_arg` - try `init:get_argument(Key)`; expects a single value, if any.
 * `init_arg` - try `init:get_argument(Key)`; expects a single value, if any.
 * `{mnesia, ActivityType, Oid, Pos}` - try
 * `{mnesia, ActivityType, Oid, Pos}` - try
 `mnesia:activity(ActivityType, fun() -> mnesia:read(Oid) end)`; retrieve the
 `mnesia:activity(ActivityType, fun() -> mnesia:read(Oid) end)`; retrieve the
@@ -397,8 +414,18 @@ exhausted; if not set, `undefined` will be returned.
 
 
 
 
 While any alternative can occur more than once, the only one that might make
 While any alternative can occur more than once, the only one that might make
-sense to repeat is `{default, Value}`.  
-The last instance will be the one that determines the return value.
+sense to use multiple times is `{default, Value}`.
+
+
+
+The return value will be one of:
+
+
+
+* The value of the first matching alternative, or exception caused by `error`,
+whichever comes first
+* The last instance of `{default, Value}`, or `undefined`, if there is no
+matching alternative, default or `error` entry in the list.
 
 
 The `error` option can be used to assert that a value has been previously
 The `error` option can be used to assert that a value has been previously
 cached. Alternatively, it can be used to assert that a value is either cached
 cached. Alternatively, it can be used to assert that a value is either cached

+ 1 - 1
src/gproc.app.src

@@ -5,7 +5,7 @@
 {application, gproc,
 {application, gproc,
  [
  [
   {description, "GPROC"},
   {description, "GPROC"},
-  {vsn, "0.2.6"},
+  {vsn, "0.2.7"},
   {id, "GPROC"},
   {id, "GPROC"},
   {registered, [ ] },
   {registered, [ ] },
   %% NOTE: do not list applications which are load-only!
   %% NOTE: do not list applications which are load-only!

+ 16 - 5
src/gproc.erl

@@ -26,6 +26,9 @@
 %%                                a = aggregate_counter
 %%                                a = aggregate_counter
 %% @type scope() = l | g. l = local registration; g = global registration
 %% @type scope() = l | g. l = local registration; g = global registration
 %%
 %%
+%% @type reg_id() = {type(), scope(), any()}.
+%% @type unique_id() = {n | a, scope(), any()}.
+%%
 %% Type and scope for select(), qlc() and stepping:
 %% Type and scope for select(), qlc() and stepping:
 %%
 %%
 %% @type sel_scope() = scope | all | global | local.
 %% @type sel_scope() = scope | all | global | local.
@@ -283,7 +286,9 @@ get_env(Scope, App, Key) ->
 %%   Strategy = [Alternative]
 %%   Strategy = [Alternative]
 %%   Alternative = app_env
 %%   Alternative = app_env
 %%               | os_env
 %%               | os_env
-%%               | inherit | {inherit, pid()}
+%%               | inherit | {inherit, pid()} | {inherit, unique_id()}
+%%               | init_arg
+%%               | {mnesia, ActivityType, Oid, Pos}
 %%               | {default, term()}
 %%               | {default, term()}
 %%               | error
 %%               | error
 %% @doc Fetch an environment value, potentially cached as a `gproc_env' property.
 %% @doc Fetch an environment value, potentially cached as a `gproc_env' property.
@@ -299,8 +304,8 @@ get_env(Scope, App, Key) ->
 %% * `{os_env, ENV}' - try `os:getenv(ENV)'
 %% * `{os_env, ENV}' - try `os:getenv(ENV)'
 %% * `inherit' - inherit the cached value, if any, held by the (proc_lib) parent.
 %% * `inherit' - inherit the cached value, if any, held by the (proc_lib) parent.
 %% * `{inherit, Pid}' - inherit the cached value, if any, held by `Pid'.
 %% * `{inherit, Pid}' - inherit the cached value, if any, held by `Pid'.
-%% * `{inherit, Name}' - inherit the cached value, if any, held by the process
-%%    registered in `gproc' as `Name'.
+%% * `{inherit, Id}' - inherit the cached value, if any, held by the process
+%%    registered in `gproc' as `Id'.
 %% * `init_arg' - try `init:get_argument(Key)'; expects a single value, if any.
 %% * `init_arg' - try `init:get_argument(Key)'; expects a single value, if any.
 %% * `{mnesia, ActivityType, Oid, Pos}' - try 
 %% * `{mnesia, ActivityType, Oid, Pos}' - try 
 %%   `mnesia:activity(ActivityType, fun() -> mnesia:read(Oid) end)'; retrieve the
 %%   `mnesia:activity(ActivityType, fun() -> mnesia:read(Oid) end)'; retrieve the
@@ -310,8 +315,14 @@ get_env(Scope, App, Key) ->
 %% * `error' - raise an exception, `erlang:error(gproc_env, [App, Key, Scope])'.
 %% * `error' - raise an exception, `erlang:error(gproc_env, [App, Key, Scope])'.
 %%
 %%
 %% While any alternative can occur more than once, the only one that might make 
 %% While any alternative can occur more than once, the only one that might make 
-%% sense to repeat is `{default, Value}'. 
-%% The last instance will be the one that determines the return value.
+%% sense to use multiple times is `{default, Value}'. 
+%% 
+%% The return value will be one of:
+%%
+%% * The value of the first matching alternative, or exception caused by `error',
+%%   whichever comes first
+%% * The last instance of `{default, Value}', or `undefined', if there is no
+%%   matching alternative, default or `error' entry in the list.
 %%
 %%
 %% The `error' option can be used to assert that a value has been previously 
 %% The `error' option can be used to assert that a value has been previously 
 %% cached. Alternatively, it can be used to assert that a value is either cached
 %% cached. Alternatively, it can be used to assert that a value is either cached

+ 1 - 1
test/gproc_dist_tests.erl

@@ -260,7 +260,7 @@ start_slave(Name) ->
     case node() of
     case node() of
         nonode@nohost ->
         nonode@nohost ->
             os:cmd("epmd -daemon"),
             os:cmd("epmd -daemon"),
-            {ok, _} = net_kernel:start([gproc_master, longnames]);
+            {ok, _} = net_kernel:start([gproc_master, shortnames]);
         _ ->
         _ ->
             ok
             ok
     end,
     end,