|
@@ -10,8 +10,6 @@
|
|
Extended process registry
|
|
Extended process registry
|
|
This module implements an extended process registry.
|
|
This module implements an extended process registry.
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
__Behaviours:__ [`gen_server`](gen_server.md).
|
|
__Behaviours:__ [`gen_server`](gen_server.md).
|
|
|
|
|
|
__Authors:__ Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)).<a name="description"></a>
|
|
__Authors:__ Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)).<a name="description"></a>
|
|
@@ -19,17 +17,25 @@ __Authors:__ Ulf Wiger ([`ulf@wiger.net`](mailto:ulf@wiger.net)).<a name="descri
|
|
##Description##
|
|
##Description##
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
For a detailed description, see
|
|
For a detailed description, see
|
|
[erlang07-wiger.pdf](erlang07-wiger.pdf).
|
|
[erlang07-wiger.pdf](erlang07-wiger.pdf).
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
##Tuning Gproc performance##
|
|
##Tuning Gproc performance##
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
Gproc relies on a central server and an ordered-set ets table.
|
|
Gproc relies on a central server and an ordered-set ets table.
|
|
Effort is made to perform as much work as possible in the client without
|
|
Effort is made to perform as much work as possible in the client without
|
|
sacrificing consistency. A few things can be tuned by setting the following
|
|
sacrificing consistency. A few things can be tuned by setting the following
|
|
application environment variables in the top application of `gproc`
|
|
application environment variables in the top application of `gproc`
|
|
-(usually `gproc`):* `{ets_options, list()}` - Currently, the options `{write_concurrency, F}`
|
|
|
|
|
|
+(usually `gproc`):
|
|
|
|
+
|
|
|
|
+* `{ets_options, list()}` - Currently, the options `{write_concurrency, F}`
|
|
and `{read_concurrency, F}` are allowed. The default is
|
|
and `{read_concurrency, F}` are allowed. The default is
|
|
`[{write_concurrency, true}, {read_concurrency, true}]`
|
|
`[{write_concurrency, true}, {read_concurrency, true}]`
|
|
* `{server_options, list()}` - These will be passed as spawn options when
|
|
* `{server_options, list()}` - These will be passed as spawn options when
|
|
@@ -218,12 +224,8 @@ a unique name registered via gproc.</td></tr><tr><td valign="top"><a href="#mreg
|
|
###add_global_aggr_counter/1##
|
|
###add_global_aggr_counter/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_global_aggr_counter(Name) -> any()`
|
|
`add_global_aggr_counter(Name) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`reg({a, g, Name})`](#reg-1).
|
|
Equivalent to [`reg({a, g, Name})`](#reg-1).
|
|
|
|
|
|
Registers a global (unique) aggregated counter.<a name="add_global_counter-2"></a>
|
|
Registers a global (unique) aggregated counter.<a name="add_global_counter-2"></a>
|
|
@@ -231,45 +233,29 @@ Registers a global (unique) aggregated counter.<a name="add_global_counter-2"></
|
|
###add_global_counter/2##
|
|
###add_global_counter/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_global_counter(Name, Initial) -> any()`
|
|
`add_global_counter(Name, Initial) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Registers a global (non-unique) counter. @equiv reg({c,g,Name},Value)<a name="add_global_name-1"></a>
|
|
Registers a global (non-unique) counter. @equiv reg({c,g,Name},Value)<a name="add_global_name-1"></a>
|
|
|
|
|
|
###add_global_name/1##
|
|
###add_global_name/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_global_name(Name) -> any()`
|
|
`add_global_name(Name) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Registers a global (unique) name. @equiv reg({n,g,Name})<a name="add_global_property-2"></a>
|
|
Registers a global (unique) name. @equiv reg({n,g,Name})<a name="add_global_property-2"></a>
|
|
|
|
|
|
###add_global_property/2##
|
|
###add_global_property/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_global_property(Name, Value) -> any()`
|
|
`add_global_property(Name, Value) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Registers a global (non-unique) property. @equiv reg({p,g,Name},Value)<a name="add_local_aggr_counter-1"></a>
|
|
Registers a global (non-unique) property. @equiv reg({p,g,Name},Value)<a name="add_local_aggr_counter-1"></a>
|
|
|
|
|
|
###add_local_aggr_counter/1##
|
|
###add_local_aggr_counter/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_local_aggr_counter(Name) -> any()`
|
|
`add_local_aggr_counter(Name) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`reg({a, l, Name})`](#reg-1).
|
|
Equivalent to [`reg({a, l, Name})`](#reg-1).
|
|
|
|
|
|
Registers a local (unique) aggregated counter.<a name="add_local_counter-2"></a>
|
|
Registers a local (unique) aggregated counter.<a name="add_local_counter-2"></a>
|
|
@@ -277,45 +263,29 @@ Registers a local (unique) aggregated counter.<a name="add_local_counter-2"></a>
|
|
###add_local_counter/2##
|
|
###add_local_counter/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_local_counter(Name, Initial) -> any()`
|
|
`add_local_counter(Name, Initial) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Registers a local (non-unique) counter. @equiv reg({c,l,Name},Value)<a name="add_local_name-1"></a>
|
|
Registers a local (non-unique) counter. @equiv reg({c,l,Name},Value)<a name="add_local_name-1"></a>
|
|
|
|
|
|
###add_local_name/1##
|
|
###add_local_name/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_local_name(Name) -> any()`
|
|
`add_local_name(Name) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Registers a local (unique) name. @equiv reg({n,l,Name})<a name="add_local_property-2"></a>
|
|
Registers a local (unique) name. @equiv reg({n,l,Name})<a name="add_local_property-2"></a>
|
|
|
|
|
|
###add_local_property/2##
|
|
###add_local_property/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_local_property(Name, Value) -> any()`
|
|
`add_local_property(Name, Value) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Registers a local (non-unique) property. @equiv reg({p,l,Name},Value)<a name="add_shared_local_counter-2"></a>
|
|
Registers a local (non-unique) property. @equiv reg({p,l,Name},Value)<a name="add_shared_local_counter-2"></a>
|
|
|
|
|
|
###add_shared_local_counter/2##
|
|
###add_shared_local_counter/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`add_shared_local_counter(Name, Initial) -> any()`
|
|
`add_shared_local_counter(Name, Initial) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`reg_shared({c, l, Name}, Value)`](#reg_shared-2).
|
|
Equivalent to [`reg_shared({c, l, Name}, Value)`](#reg_shared-2).
|
|
|
|
|
|
Registers a local shared (unique) counter.<a name="audit_process-1"></a>
|
|
Registers a local shared (unique) counter.<a name="audit_process-1"></a>
|
|
@@ -323,8 +293,6 @@ Registers a local shared (unique) counter.<a name="audit_process-1"></a>
|
|
###audit_process/1##
|
|
###audit_process/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>audit_process(Pid::pid()) -> ok</pre>
|
|
<pre>audit_process(Pid::pid()) -> ok</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
@@ -334,26 +302,18 @@ Registers a local shared (unique) counter.<a name="audit_process-1"></a>
|
|
###await/1##
|
|
###await/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>await(Key::<a href="#type-key">key()</a>) -> {pid(), Value}</pre>
|
|
<pre>await(Key::<a href="#type-key">key()</a>) -> {pid(), Value}</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`await(Key, infinity)`](#await-2).<a name="await-2"></a>
|
|
Equivalent to [`await(Key, infinity)`](#await-2).<a name="await-2"></a>
|
|
|
|
|
|
###await/2##
|
|
###await/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>await(Key::<a href="#type-key">key()</a>, Timeout) -> {pid(), Value}</pre>
|
|
<pre>await(Key::<a href="#type-key">key()</a>, Timeout) -> {pid(), Value}</pre>
|
|
<ul class="definitions"><li><pre>Timeout = integer() | infinity</pre></li></ul>
|
|
<ul class="definitions"><li><pre>Timeout = integer() | infinity</pre></li></ul>
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Wait for a local name to be registered.
|
|
Wait for a local name to be registered.
|
|
The function raises an exception if the timeout expires. Timeout must be
|
|
The function raises an exception if the timeout expires. Timeout must be
|
|
either an interger > 0 or 'infinity'.
|
|
either an interger > 0 or 'infinity'.
|
|
@@ -365,23 +325,19 @@ registered (the difference: await/2 also returns the value).<a name="cancel_wait
|
|
###cancel_wait/2##
|
|
###cancel_wait/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>cancel_wait(Key::<a href="#type-key">key()</a>, Ref) -> ok</pre>
|
|
<pre>cancel_wait(Key::<a href="#type-key">key()</a>, Ref) -> ok</pre>
|
|
<ul class="definitions"><li><pre>Ref = all | reference()</pre></li></ul>
|
|
<ul class="definitions"><li><pre>Ref = all | reference()</pre></li></ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Cancels a previous call to nb_wait/1
|
|
|
|
|
|
-
|
|
|
|
-Cancels a previous call to nb_wait/1If `Ref = all`, all wait requests on `Key` from the calling process
|
|
|
|
|
|
+If `Ref = all`, all wait requests on `Key` from the calling process
|
|
are canceled.<a name="cancel_wait_or_monitor-1"></a>
|
|
are canceled.<a name="cancel_wait_or_monitor-1"></a>
|
|
|
|
|
|
###cancel_wait_or_monitor/1##
|
|
###cancel_wait_or_monitor/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`cancel_wait_or_monitor(Key) -> any()`
|
|
`cancel_wait_or_monitor(Key) -> any()`
|
|
|
|
|
|
<a name="default-1"></a>
|
|
<a name="default-1"></a>
|
|
@@ -389,8 +345,6 @@ are canceled.<a name="cancel_wait_or_monitor-1"></a>
|
|
###default/1##
|
|
###default/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`default(X1) -> any()`
|
|
`default(X1) -> any()`
|
|
|
|
|
|
<a name="demonitor-2"></a>
|
|
<a name="demonitor-2"></a>
|
|
@@ -398,14 +352,10 @@ are canceled.<a name="cancel_wait_or_monitor-1"></a>
|
|
###demonitor/2##
|
|
###demonitor/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>demonitor(Key::<a href="#type-key">key()</a>, Ref::reference()) -> ok</pre>
|
|
<pre>demonitor(Key::<a href="#type-key">key()</a>, Ref::reference()) -> ok</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Remove a monitor on a registered name
|
|
Remove a monitor on a registered name
|
|
This function is the reverse of monitor/1. It removes a monitor previously
|
|
This function is the reverse of monitor/1. It removes a monitor previously
|
|
set on a unique name. This function always succeeds given legal input.<a name="first-1"></a>
|
|
set on a unique name. This function always succeeds given legal input.<a name="first-1"></a>
|
|
@@ -413,51 +363,45 @@ set on a unique name. This function always succeeds given legal input.<a name="f
|
|
###first/1##
|
|
###first/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>first(Context::<a href="#type-context">context()</a>) -> <a href="#type-key">key()</a> | '$end_of_table'</pre>
|
|
<pre>first(Context::<a href="#type-context">context()</a>) -> <a href="#type-key">key()</a> | '$end_of_table'</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Behaves as ets:first(Tab) for a given type of registration object.
|
|
|
|
|
|
-
|
|
|
|
-Behaves as ets:first(Tab) for a given type of registration object.See [`http://www.erlang.org/doc/man/ets.html#first-1`](http://www.erlang.org/doc/man/ets.html#first-1).
|
|
|
|
|
|
+See [`http://www.erlang.org/doc/man/ets.html#first-1`](http://www.erlang.org/doc/man/ets.html#first-1).
|
|
The registry behaves as an ordered_set table.<a name="get_env-3"></a>
|
|
The registry behaves as an ordered_set table.<a name="get_env-3"></a>
|
|
|
|
|
|
###get_env/3##
|
|
###get_env/3##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>get_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom()) -> term()</pre>
|
|
<pre>get_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom()) -> term()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`get_env(Scope, App, Key, [app_env])`](#get_env-4).<a name="get_env-4"></a>
|
|
Equivalent to [`get_env(Scope, App, Key, [app_env])`](#get_env-4).<a name="get_env-4"></a>
|
|
|
|
|
|
###get_env/4##
|
|
###get_env/4##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<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()} | {inherit, <a href="#type-unique_id">unique_id()</a>} | init_arg | {mnesia, ActivityType, Oid, Pos} | {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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Read an environment value, potentially cached as a `gproc_env` property.
|
|
|
|
|
|
|
|
|
|
-Read an environment value, potentially cached as a `gproc_env` property.
|
|
|
|
|
|
|
|
This function first tries to read the value of a cached property,
|
|
This function first tries to read the value of a cached property,
|
|
`{p, Scope, {gproc_env, App, Key}}`. If this fails, it will try the provided
|
|
`{p, Scope, {gproc_env, App, Key}}`. If this fails, it will try the provided
|
|
alternative strategy. `Strategy` is a list of alternatives, tried in order.
|
|
alternative strategy. `Strategy` is a list of alternatives, tried in order.
|
|
Each alternative can be one of:
|
|
Each alternative can be one of:
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
* `app_env` - try `application:get_env(App, Key)`
|
|
* `app_env` - try `application:get_env(App, Key)`
|
|
* `os_env` - try `os:getenv(ENV)`, where `ENV` is `Key` converted into an
|
|
* `os_env` - try `os:getenv(ENV)`, where `ENV` is `Key` converted into an
|
|
uppercase string
|
|
uppercase string
|
|
@@ -474,15 +418,23 @@ the value in position `Pos` if object found.
|
|
been exhausted; if not set, `undefined` will be returned.
|
|
been exhausted; if not set, `undefined` will be returned.
|
|
* `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 use multiple times is `{default, Value}`.
|
|
sense to use multiple times is `{default, Value}`.
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
The return value will be one of:
|
|
The return value will be one of:
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
* The value of the first matching alternative, or `error` eception,
|
|
* The value of the first matching alternative, or `error` eception,
|
|
whichever comes first
|
|
whichever comes first
|
|
* The last instance of `{default, Value}`, or `undefined`, if there is no
|
|
* 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
|
|
|
|
|
|
+matching alternative, default or `error` entry in the list.
|
|
|
|
+
|
|
|
|
+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
|
|
or at least defined somewhere,
|
|
or at least defined somewhere,
|
|
e.g. `get_env(l, mnesia, dir, [app_env, error])`.<a name="get_set_env-3"></a>
|
|
e.g. `get_env(l, mnesia, dir, [app_env, error])`.<a name="get_set_env-3"></a>
|
|
@@ -490,30 +442,24 @@ e.g. `get_env(l, mnesia, dir, [app_env, error])`.<a name="get_set_env-3"></a>
|
|
###get_set_env/3##
|
|
###get_set_env/3##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>get_set_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom()) -> term()</pre>
|
|
<pre>get_set_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom()) -> term()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`get_set_env(Scope, App, Key, [app_env])`](#get_set_env-4).<a name="get_set_env-4"></a>
|
|
Equivalent to [`get_set_env(Scope, App, Key, [app_env])`](#get_set_env-4).<a name="get_set_env-4"></a>
|
|
|
|
|
|
###get_set_env/4##
|
|
###get_set_env/4##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>get_set_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom(), Strategy) -> Value</pre>
|
|
<pre>get_set_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom(), Strategy) -> Value</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Fetch and cache an environment value, if not already cached.
|
|
|
|
|
|
-
|
|
|
|
-Fetch and cache an environment value, if not already cached.This function does the same thing as [`get_env/4`](#get_env-4), but also updates the
|
|
|
|
|
|
+This function does the same thing as [`get_env/4`](#get_env-4), but also updates the
|
|
cache. Note that the cache will be updated even if the result of the lookup
|
|
cache. Note that the cache will be updated even if the result of the lookup
|
|
is `undefined`.
|
|
is `undefined`.
|
|
|
|
|
|
@@ -523,152 +469,136 @@ __See also:__ [get_env/4](#get_env-4).<a name="get_value-1"></a>
|
|
###get_value/1##
|
|
###get_value/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>get_value(Key) -> Value</pre>
|
|
<pre>get_value(Key) -> Value</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Reads the value stored with a key registered to the current process.
|
|
|
|
|
|
-
|
|
|
|
-Reads the value stored with a key registered to the current process.If no such key is registered to the current process, this function exits.<a name="get_value-2"></a>
|
|
|
|
|
|
+If no such key is registered to the current process, this function exits.<a name="get_value-2"></a>
|
|
|
|
|
|
###get_value/2##
|
|
###get_value/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>get_value(Key, Pid) -> Value</pre>
|
|
<pre>get_value(Key, Pid) -> Value</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Reads the value stored with a key registered to the process Pid.
|
|
|
|
|
|
-
|
|
|
|
-Reads the value stored with a key registered to the process Pid.If `Pid == shared`, the value of a shared key (see [`reg_shared/1`](#reg_shared-1))
|
|
|
|
|
|
+If `Pid == shared`, the value of a shared key (see [`reg_shared/1`](#reg_shared-1))
|
|
will be read.<a name="give_away-2"></a>
|
|
will be read.<a name="give_away-2"></a>
|
|
|
|
|
|
###give_away/2##
|
|
###give_away/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>give_away(From::<a href="#type-key">key()</a>, To::pid() | <a href="#type-key">key()</a>) -> undefined | pid()</pre>
|
|
<pre>give_away(From::<a href="#type-key">key()</a>, To::pid() | <a href="#type-key">key()</a>) -> undefined | pid()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Atomically transfers the key `From` to the process identified by `To`.
|
|
|
|
|
|
|
|
|
|
-Atomically transfers the key `From` to the process identified by `To`.
|
|
|
|
|
|
|
|
This function transfers any gproc key (name, property, counter, aggr counter)
|
|
This function transfers any gproc key (name, property, counter, aggr counter)
|
|
from one process to another, and returns the pid of the new owner.
|
|
from one process to another, and returns the pid of the new owner.
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
`To` must be either a pid or a unique name (name or aggregated counter), but
|
|
`To` must be either a pid or a unique name (name or aggregated counter), but
|
|
does not necessarily have to resolve to an existing process. If there is
|
|
does not necessarily have to resolve to an existing process. If there is
|
|
no process registered with the `To` key, `give_away/2` returns `undefined`,
|
|
no process registered with the `To` key, `give_away/2` returns `undefined`,
|
|
and the `From` key is effectively unregistered.
|
|
and the `From` key is effectively unregistered.
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
It is allowed to give away a key to oneself, but of course, this operation
|
|
It is allowed to give away a key to oneself, but of course, this operation
|
|
-will have no effect.Fails with `badarg` if the calling process does not have a `From` key
|
|
|
|
|
|
+will have no effect.
|
|
|
|
+
|
|
|
|
+Fails with `badarg` if the calling process does not have a `From` key
|
|
registered.<a name="goodbye-0"></a>
|
|
registered.<a name="goodbye-0"></a>
|
|
|
|
|
|
###goodbye/0##
|
|
###goodbye/0##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>goodbye() -> ok</pre>
|
|
<pre>goodbye() -> ok</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Unregister all items of the calling process and inform gproc
|
|
Unregister all items of the calling process and inform gproc
|
|
-to forget about the calling process.This function is more efficient than letting gproc perform these
|
|
|
|
|
|
+to forget about the calling process.
|
|
|
|
+
|
|
|
|
+This function is more efficient than letting gproc perform these
|
|
cleanup operations.<a name="i-0"></a>
|
|
cleanup operations.<a name="i-0"></a>
|
|
|
|
|
|
###i/0##
|
|
###i/0##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>i() -> ok</pre>
|
|
<pre>i() -> ok</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Similar to the built-in shell command `i()` but inserts information
|
|
Similar to the built-in shell command `i()` but inserts information
|
|
about names and properties registered in Gproc, where applicable.<a name="info-1"></a>
|
|
about names and properties registered in Gproc, where applicable.<a name="info-1"></a>
|
|
|
|
|
|
###info/1##
|
|
###info/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>info(Pid::pid()) -> ProcessInfo</pre>
|
|
<pre>info(Pid::pid()) -> ProcessInfo</pre>
|
|
<ul class="definitions"><li><pre>ProcessInfo = [{gproc, [{Key, Value}]} | ProcessInfo]</pre></li></ul>
|
|
<ul class="definitions"><li><pre>ProcessInfo = [{gproc, [{Key, Value}]} | ProcessInfo]</pre></li></ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Similar to `process_info(Pid)` but with additional gproc info.
|
|
|
|
|
|
-
|
|
|
|
-Similar to `process_info(Pid)` but with additional gproc info.Returns the same information as process_info(Pid), but with the
|
|
|
|
|
|
+Returns the same information as process_info(Pid), but with the
|
|
addition of a `gproc` information item, containing the `{Key,Value}`
|
|
addition of a `gproc` information item, containing the `{Key,Value}`
|
|
pairs registered to the process.<a name="info-2"></a>
|
|
pairs registered to the process.<a name="info-2"></a>
|
|
|
|
|
|
###info/2##
|
|
###info/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>info(Pid::pid(), Item::atom()) -> {Item, Info}</pre>
|
|
<pre>info(Pid::pid(), Item::atom()) -> {Item, Info}</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Similar to process_info(Pid, Item), but with additional gproc info.
|
|
|
|
|
|
-
|
|
|
|
-Similar to process_info(Pid, Item), but with additional gproc info.For `Item = gproc`, this function returns a list of `{Key, Value}` pairs
|
|
|
|
|
|
+For `Item = gproc`, this function returns a list of `{Key, Value}` pairs
|
|
registered to the process Pid. For other values of Item, it returns the
|
|
registered to the process Pid. For other values of Item, it returns the
|
|
same as [`http://www.erlang.org/doc/man/erlang.html#process_info-2`](http://www.erlang.org/doc/man/erlang.html#process_info-2).<a name="last-1"></a>
|
|
same as [`http://www.erlang.org/doc/man/erlang.html#process_info-2`](http://www.erlang.org/doc/man/erlang.html#process_info-2).<a name="last-1"></a>
|
|
|
|
|
|
###last/1##
|
|
###last/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>last(Context::<a href="#type-context">context()</a>) -> <a href="#type-key">key()</a> | '$end_of_table'</pre>
|
|
<pre>last(Context::<a href="#type-context">context()</a>) -> <a href="#type-key">key()</a> | '$end_of_table'</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Behaves as ets:last(Tab) for a given type of registration object.
|
|
|
|
|
|
-
|
|
|
|
-Behaves as ets:last(Tab) for a given type of registration object.See [`http://www.erlang.org/doc/man/ets.html#last-1`](http://www.erlang.org/doc/man/ets.html#last-1).
|
|
|
|
|
|
+See [`http://www.erlang.org/doc/man/ets.html#last-1`](http://www.erlang.org/doc/man/ets.html#last-1).
|
|
The registry behaves as an ordered_set table.<a name="lookup_global_aggr_counter-1"></a>
|
|
The registry behaves as an ordered_set table.<a name="lookup_global_aggr_counter-1"></a>
|
|
|
|
|
|
###lookup_global_aggr_counter/1##
|
|
###lookup_global_aggr_counter/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_global_aggr_counter(Name::any()) -> integer()</pre>
|
|
<pre>lookup_global_aggr_counter(Name::any()) -> integer()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`where({a, g, Name})`](#where-1).
|
|
Equivalent to [`where({a, g, Name})`](#where-1).
|
|
|
|
|
|
Lookup a global (unique) aggregated counter and returns its value.
|
|
Lookup a global (unique) aggregated counter and returns its value.
|
|
@@ -677,14 +607,10 @@ Fails if there is no such object.<a name="lookup_global_counters-1"></a>
|
|
###lookup_global_counters/1##
|
|
###lookup_global_counters/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_global_counters(Counter::any()) -> [{pid(), Value::integer()}]</pre>
|
|
<pre>lookup_global_counters(Counter::any()) -> [{pid(), Value::integer()}]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`lookup_values({c, g, Counter})`](#lookup_values-1).
|
|
Equivalent to [`lookup_values({c, g, Counter})`](#lookup_values-1).
|
|
|
|
|
|
Look up all global (non-unique) instances of a given Counter.
|
|
Look up all global (non-unique) instances of a given Counter.
|
|
@@ -693,14 +619,10 @@ Returns a list of {Pid, Value} tuples for all matching objects.<a name="lookup_g
|
|
###lookup_global_name/1##
|
|
###lookup_global_name/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_global_name(Name::any()) -> pid()</pre>
|
|
<pre>lookup_global_name(Name::any()) -> pid()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`where({n, g, Name})`](#where-1).
|
|
Equivalent to [`where({n, g, Name})`](#where-1).
|
|
|
|
|
|
Lookup a global unique name. Fails if there is no such name.<a name="lookup_global_properties-1"></a>
|
|
Lookup a global unique name. Fails if there is no such name.<a name="lookup_global_properties-1"></a>
|
|
@@ -708,14 +630,10 @@ Lookup a global unique name. Fails if there is no such name.<a name="lookup_glob
|
|
###lookup_global_properties/1##
|
|
###lookup_global_properties/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_global_properties(Property::any()) -> [{pid(), Value}]</pre>
|
|
<pre>lookup_global_properties(Property::any()) -> [{pid(), Value}]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`lookup_values({p, g, Property})`](#lookup_values-1).
|
|
Equivalent to [`lookup_values({p, g, Property})`](#lookup_values-1).
|
|
|
|
|
|
Look up all global (non-unique) instances of a given Property.
|
|
Look up all global (non-unique) instances of a given Property.
|
|
@@ -724,14 +642,10 @@ Returns a list of {Pid, Value} tuples for all matching objects.<a name="lookup_l
|
|
###lookup_local_aggr_counter/1##
|
|
###lookup_local_aggr_counter/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_local_aggr_counter(Name::any()) -> integer()</pre>
|
|
<pre>lookup_local_aggr_counter(Name::any()) -> integer()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`where({a, l, Name})`](#where-1).
|
|
Equivalent to [`where({a, l, Name})`](#where-1).
|
|
|
|
|
|
Lookup a local (unique) aggregated counter and returns its value.
|
|
Lookup a local (unique) aggregated counter and returns its value.
|
|
@@ -740,14 +654,10 @@ Fails if there is no such object.<a name="lookup_local_counters-1"></a>
|
|
###lookup_local_counters/1##
|
|
###lookup_local_counters/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_local_counters(Counter::any()) -> [{pid(), Value::integer()}]</pre>
|
|
<pre>lookup_local_counters(Counter::any()) -> [{pid(), Value::integer()}]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`lookup_values({c, l, Counter})`](#lookup_values-1).
|
|
Equivalent to [`lookup_values({c, l, Counter})`](#lookup_values-1).
|
|
|
|
|
|
Look up all local (non-unique) instances of a given Counter.
|
|
Look up all local (non-unique) instances of a given Counter.
|
|
@@ -756,14 +666,10 @@ Returns a list of {Pid, Value} tuples for all matching objects.<a name="lookup_l
|
|
###lookup_local_name/1##
|
|
###lookup_local_name/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_local_name(Name::any()) -> pid()</pre>
|
|
<pre>lookup_local_name(Name::any()) -> pid()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`where({n, l, Name})`](#where-1).
|
|
Equivalent to [`where({n, l, Name})`](#where-1).
|
|
|
|
|
|
Lookup a local unique name. Fails if there is no such name.<a name="lookup_local_properties-1"></a>
|
|
Lookup a local unique name. Fails if there is no such name.<a name="lookup_local_properties-1"></a>
|
|
@@ -771,14 +677,10 @@ Lookup a local unique name. Fails if there is no such name.<a name="lookup_local
|
|
###lookup_local_properties/1##
|
|
###lookup_local_properties/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_local_properties(Property::any()) -> [{pid(), Value}]</pre>
|
|
<pre>lookup_local_properties(Property::any()) -> [{pid(), Value}]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`lookup_values({p, l, Property})`](#lookup_values-1).
|
|
Equivalent to [`lookup_values({p, l, Property})`](#lookup_values-1).
|
|
|
|
|
|
Look up all local (non-unique) instances of a given Property.
|
|
Look up all local (non-unique) instances of a given Property.
|
|
@@ -787,87 +689,71 @@ Returns a list of {Pid, Value} tuples for all matching objects.<a name="lookup_p
|
|
###lookup_pid/1##
|
|
###lookup_pid/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_pid(Key) -> Pid</pre>
|
|
<pre>lookup_pid(Key) -> Pid</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Lookup the Pid stored with a key.
|
|
Lookup the Pid stored with a key.
|
|
<a name="lookup_pids-1"></a>
|
|
<a name="lookup_pids-1"></a>
|
|
|
|
|
|
###lookup_pids/1##
|
|
###lookup_pids/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_pids(Key::<a href="#type-key">key()</a>) -> [pid()]</pre>
|
|
<pre>lookup_pids(Key::<a href="#type-key">key()</a>) -> [pid()]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Returns a list of pids with the published key Key
|
|
|
|
|
|
-
|
|
|
|
-Returns a list of pids with the published key KeyIf the type of registration entry is either name or aggregated counter,
|
|
|
|
|
|
+If the type of registration entry is either name or aggregated counter,
|
|
this function will return either an empty list, or a list of one pid.
|
|
this function will return either an empty list, or a list of one pid.
|
|
For non-unique types, the return value can be a list of any length.<a name="lookup_value-1"></a>
|
|
For non-unique types, the return value can be a list of any length.<a name="lookup_value-1"></a>
|
|
|
|
|
|
###lookup_value/1##
|
|
###lookup_value/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_value(Key) -> Value</pre>
|
|
<pre>lookup_value(Key) -> Value</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Lookup the value stored with a key.
|
|
Lookup the value stored with a key.
|
|
<a name="lookup_values-1"></a>
|
|
<a name="lookup_values-1"></a>
|
|
|
|
|
|
###lookup_values/1##
|
|
###lookup_values/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>lookup_values(Key::<a href="#type-key">key()</a>) -> [{pid(), Value}]</pre>
|
|
<pre>lookup_values(Key::<a href="#type-key">key()</a>) -> [{pid(), Value}]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Retrieve the `{Pid,Value}` pairs corresponding to Key.
|
|
|
|
|
|
-
|
|
|
|
-Retrieve the `{Pid,Value}` pairs corresponding to Key.Key refer to any type of registry object. If it refers to a unique
|
|
|
|
|
|
+Key refer to any type of registry object. If it refers to a unique
|
|
object, the list will be of length 0 or 1. If it refers to a non-unique
|
|
object, the list will be of length 0 or 1. If it refers to a non-unique
|
|
object, the return value can be a list of any length.<a name="monitor-1"></a>
|
|
object, the return value can be a list of any length.<a name="monitor-1"></a>
|
|
|
|
|
|
###monitor/1##
|
|
###monitor/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>monitor(Key::<a href="#type-key">key()</a>) -> reference()</pre>
|
|
<pre>monitor(Key::<a href="#type-key">key()</a>) -> reference()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
monitor a registered name
|
|
monitor a registered name
|
|
This function works much like erlang:monitor(process, Pid), but monitors
|
|
This function works much like erlang:monitor(process, Pid), but monitors
|
|
a unique name registered via gproc. A message, `{gproc, unreg, Ref, Key}`
|
|
a unique name registered via gproc. A message, `{gproc, unreg, Ref, Key}`
|
|
will be sent to the requesting process, if the name is unregistered or
|
|
will be sent to the requesting process, if the name is unregistered or
|
|
-the registered process dies.If the name is not yet registered, the same message is sent immediately.<a name="mreg-3"></a>
|
|
|
|
-
|
|
|
|
-###mreg/3##
|
|
|
|
|
|
+the registered process dies.
|
|
|
|
|
|
|
|
+If the name is not yet registered, the same message is sent immediately.<a name="mreg-3"></a>
|
|
|
|
|
|
|
|
+###mreg/3##
|
|
|
|
|
|
|
|
|
|
<pre>mreg(T::<a href="#type-type">type()</a>, C::<a href="#type-scope">scope()</a>, KVL::[{Key::any(), Value::any()}]) -> true</pre>
|
|
<pre>mreg(T::<a href="#type-type">type()</a>, C::<a href="#type-scope">scope()</a>, KVL::[{Key::any(), Value::any()}]) -> true</pre>
|
|
@@ -876,39 +762,33 @@ the registered process dies.If the name is not yet registered, the same message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Register multiple {Key,Value} pairs of a given type and scope.
|
|
|
|
|
|
-
|
|
|
|
-Register multiple {Key,Value} pairs of a given type and scope.This function is more efficient than calling [`reg/2`](#reg-2) repeatedly.
|
|
|
|
|
|
+This function is more efficient than calling [`reg/2`](#reg-2) repeatedly.
|
|
It is also atomic in regard to unique names; either all names are registered
|
|
It is also atomic in regard to unique names; either all names are registered
|
|
or none are.<a name="munreg-3"></a>
|
|
or none are.<a name="munreg-3"></a>
|
|
|
|
|
|
###munreg/3##
|
|
###munreg/3##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>munreg(T::<a href="#type-type">type()</a>, C::<a href="#type-scope">scope()</a>, L::[Key::any()]) -> true</pre>
|
|
<pre>munreg(T::<a href="#type-type">type()</a>, C::<a href="#type-scope">scope()</a>, L::[Key::any()]) -> true</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Unregister multiple Key items of a given type and scope.
|
|
|
|
|
|
-
|
|
|
|
-Unregister multiple Key items of a given type and scope.This function is usually more efficient than calling [`unreg/1`](#unreg-1)
|
|
|
|
|
|
+This function is usually more efficient than calling [`unreg/1`](#unreg-1)
|
|
repeatedly.<a name="nb_wait-1"></a>
|
|
repeatedly.<a name="nb_wait-1"></a>
|
|
|
|
|
|
###nb_wait/1##
|
|
###nb_wait/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>nb_wait(Key::<a href="#type-key">key()</a>) -> Ref</pre>
|
|
<pre>nb_wait(Key::<a href="#type-key">key()</a>) -> Ref</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Wait for a local name to be registered.
|
|
Wait for a local name to be registered.
|
|
The caller can expect to receive a message,
|
|
The caller can expect to receive a message,
|
|
{gproc, Ref, registered, {Key, Pid, Value}}, once the name is registered.<a name="next-2"></a>
|
|
{gproc, Ref, registered, {Key, Pid, Value}}, once the name is registered.<a name="next-2"></a>
|
|
@@ -916,128 +796,110 @@ The caller can expect to receive a message,
|
|
###next/2##
|
|
###next/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>next(Context::<a href="#type-context">context()</a>, Key::<a href="#type-key">key()</a>) -> <a href="#type-key">key()</a> | '$end_of_table'</pre>
|
|
<pre>next(Context::<a href="#type-context">context()</a>, Key::<a href="#type-key">key()</a>) -> <a href="#type-key">key()</a> | '$end_of_table'</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Behaves as ets:next(Tab,Key) for a given type of registration object.
|
|
|
|
|
|
-
|
|
|
|
-Behaves as ets:next(Tab,Key) for a given type of registration object.See [`http://www.erlang.org/doc/man/ets.html#next-2`](http://www.erlang.org/doc/man/ets.html#next-2).
|
|
|
|
|
|
+See [`http://www.erlang.org/doc/man/ets.html#next-2`](http://www.erlang.org/doc/man/ets.html#next-2).
|
|
The registry behaves as an ordered_set table.<a name="prev-2"></a>
|
|
The registry behaves as an ordered_set table.<a name="prev-2"></a>
|
|
|
|
|
|
###prev/2##
|
|
###prev/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>prev(Context::<a href="#type-context">context()</a>, Key::<a href="#type-key">key()</a>) -> <a href="#type-key">key()</a> | '$end_of_table'</pre>
|
|
<pre>prev(Context::<a href="#type-context">context()</a>, Key::<a href="#type-key">key()</a>) -> <a href="#type-key">key()</a> | '$end_of_table'</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Behaves as ets:prev(Tab,Key) for a given type of registration object.
|
|
|
|
|
|
-
|
|
|
|
-Behaves as ets:prev(Tab,Key) for a given type of registration object.See [`http://www.erlang.org/doc/man/ets.html#prev-2`](http://www.erlang.org/doc/man/ets.html#prev-2).
|
|
|
|
|
|
+See [`http://www.erlang.org/doc/man/ets.html#prev-2`](http://www.erlang.org/doc/man/ets.html#prev-2).
|
|
The registry behaves as an ordered_set table.<a name="reg-1"></a>
|
|
The registry behaves as an ordered_set table.<a name="reg-1"></a>
|
|
|
|
|
|
###reg/1##
|
|
###reg/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>reg(Key::<a href="#type-key">key()</a>) -> true</pre>
|
|
<pre>reg(Key::<a href="#type-key">key()</a>) -> true</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`reg(Key, default(Key))`](#reg-2).<a name="reg-2"></a>
|
|
Equivalent to [`reg(Key, default(Key))`](#reg-2).<a name="reg-2"></a>
|
|
|
|
|
|
###reg/2##
|
|
###reg/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>reg(Key::<a href="#type-key">key()</a>, Value) -> true</pre>
|
|
<pre>reg(Key::<a href="#type-key">key()</a>, Value) -> true</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Register a name or property for the current process
|
|
|
|
|
|
-
|
|
|
|
-Register a name or property for the current process<a name="reg_shared-1"></a>
|
|
|
|
|
|
+<a name="reg_shared-1"></a>
|
|
|
|
|
|
###reg_shared/1##
|
|
###reg_shared/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>reg_shared(Key::<a href="#type-key">key()</a>) -> true</pre>
|
|
<pre>reg_shared(Key::<a href="#type-key">key()</a>) -> true</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Register a resource, but don't tie it to a particular process.
|
|
|
|
|
|
-
|
|
|
|
-Register a resource, but don't tie it to a particular process.`reg_shared({c,l,C}) -> reg_shared({c,l,C}, 0).`
|
|
|
|
|
|
+`reg_shared({c,l,C}) -> reg_shared({c,l,C}, 0).`
|
|
`reg_shared({a,l,A}) -> reg_shared({a,l,A}, undefined).`<a name="reg_shared-2"></a>
|
|
`reg_shared({a,l,A}) -> reg_shared({a,l,A}, undefined).`<a name="reg_shared-2"></a>
|
|
|
|
|
|
###reg_shared/2##
|
|
###reg_shared/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>reg_shared(Key::<a href="#type-key">key()</a>, Value) -> true</pre>
|
|
<pre>reg_shared(Key::<a href="#type-key">key()</a>, Value) -> true</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Register a resource, but don't tie it to a particular process.
|
|
|
|
|
|
|
|
|
|
-Register a resource, but don't tie it to a particular process.
|
|
|
|
|
|
|
|
Shared resources are all unique. They remain until explicitly unregistered
|
|
Shared resources are all unique. They remain until explicitly unregistered
|
|
(using [`unreg_shared/1`](#unreg_shared-1)). The types of shared resources currently
|
|
(using [`unreg_shared/1`](#unreg_shared-1)). The types of shared resources currently
|
|
supported are `counter` and `aggregated counter`. In listings and query
|
|
supported are `counter` and `aggregated counter`. In listings and query
|
|
results, shared resources appear as other similar resources, except that
|
|
results, shared resources appear as other similar resources, except that
|
|
`Pid == shared`. To wit, update_counter({c,l,myCounter}, 1, shared) would
|
|
`Pid == shared`. To wit, update_counter({c,l,myCounter}, 1, shared) would
|
|
-increment the shared counter `myCounter` with 1, provided it exists.A shared aggregated counter will track updates in exactly the same way as
|
|
|
|
|
|
+increment the shared counter `myCounter` with 1, provided it exists.
|
|
|
|
+
|
|
|
|
+A shared aggregated counter will track updates in exactly the same way as
|
|
an aggregated counter which is owned by a process.<a name="register_name-2"></a>
|
|
an aggregated counter which is owned by a process.<a name="register_name-2"></a>
|
|
|
|
|
|
###register_name/2##
|
|
###register_name/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>register_name(Name::<a href="#type-key">key()</a>, Pid::pid()) -> yes | no</pre>
|
|
<pre>register_name(Name::<a href="#type-key">key()</a>, Pid::pid()) -> yes | no</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Behaviour support callback<a name="reset_counter-1"></a>
|
|
Behaviour support callback<a name="reset_counter-1"></a>
|
|
|
|
|
|
###reset_counter/1##
|
|
###reset_counter/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>reset_counter(Key) -> {ValueBefore, ValueAfter}</pre>
|
|
<pre>reset_counter(Key) -> {ValueBefore, ValueAfter}</pre>
|
|
<ul class="definitions"><li><pre>Key = {c, Scope, Name}</pre></li><li><pre>Scope = l | g</pre></li><li><pre>ValueBefore = integer()</pre></li><li><pre>ValueAfter = integer()</pre></li></ul>
|
|
<ul class="definitions"><li><pre>Key = {c, Scope, Name}</pre></li><li><pre>Scope = l | g</pre></li><li><pre>ValueBefore = integer()</pre></li><li><pre>ValueAfter = integer()</pre></li></ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Reads and resets a counter in a "thread-safe" way
|
|
|
|
|
|
-
|
|
|
|
-Reads and resets a counter in a "thread-safe" wayThis function reads the current value of a counter and then resets it to its
|
|
|
|
|
|
+This function reads the current value of a counter and then resets it to its
|
|
initial value. The reset operation is done using [`update_counter/2`](#update_counter-2),
|
|
initial value. The reset operation is done using [`update_counter/2`](#update_counter-2),
|
|
which allows for concurrent calls to [`update_counter/2`](#update_counter-2) without losing
|
|
which allows for concurrent calls to [`update_counter/2`](#update_counter-2) without losing
|
|
updates. Aggregated counters are updated accordingly.<a name="select-1"></a>
|
|
updates. Aggregated counters are updated accordingly.<a name="select-1"></a>
|
|
@@ -1045,28 +907,32 @@ updates. Aggregated counters are updated accordingly.<a name="select-1"></a>
|
|
###select/1##
|
|
###select/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>select(Continuation::Arg) -> [Match] | {[Match], Continuation} | '$end_of_table'</pre>
|
|
<pre>select(Continuation::Arg) -> [Match] | {[Match], Continuation} | '$end_of_table'</pre>
|
|
<ul class="definitions"><li><pre>Arg = Continuation | <a href="#type-sel_pattern">sel_pattern()</a></pre></li><li><pre>Match = {Key, Pid, Value}</pre></li></ul>
|
|
<ul class="definitions"><li><pre>Arg = Continuation | <a href="#type-sel_pattern">sel_pattern()</a></pre></li><li><pre>Match = {Key, Pid, Value}</pre></li></ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Perform a select operation on the process registry
|
|
|
|
|
|
|
|
|
|
-Perform a select operation on the process registry
|
|
|
|
|
|
|
|
When Arg = Contination, resume a gproc:select/1 operation
|
|
When Arg = Contination, resume a gproc:select/1 operation
|
|
(see [ets:select/1](http://www.erlang.org/doc/man/ets.html#select-1)
|
|
(see [ets:select/1](http://www.erlang.org/doc/man/ets.html#select-1)
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
When Arg = <code><a href="#type-sel_pattern">sel_pattern()</a></code>, this function executes a select operation,
|
|
When Arg = <code><a href="#type-sel_pattern">sel_pattern()</a></code>, this function executes a select operation,
|
|
emulating ets:select/1
|
|
emulating ets:select/1
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
[`select/2`](#select-2) offers the opportunity to narrow the search
|
|
[`select/2`](#select-2) offers the opportunity to narrow the search
|
|
(by limiting to only global or local scope, or a single type of object).
|
|
(by limiting to only global or local scope, or a single type of object).
|
|
When only a pattern as single argument is given, both global and local scope,
|
|
When only a pattern as single argument is given, both global and local scope,
|
|
as well as all types of object can be searched. Note that the pattern may
|
|
as well as all types of object can be searched. Note that the pattern may
|
|
-still limit the select operation so that scanning the entire table is avoided.The physical representation in the registry may differ from the above,
|
|
|
|
|
|
+still limit the select operation so that scanning the entire table is avoided.
|
|
|
|
+
|
|
|
|
+The physical representation in the registry may differ from the above,
|
|
but the select patterns are transformed appropriately. The logical
|
|
but the select patterns are transformed appropriately. The logical
|
|
representation for the gproc select operations is given by
|
|
representation for the gproc select operations is given by
|
|
<code><a href="#type-headpat">headpat()</a></code>.<a name="select-2"></a>
|
|
<code><a href="#type-headpat">headpat()</a></code>.<a name="select-2"></a>
|
|
@@ -1074,20 +940,20 @@ representation for the gproc select operations is given by
|
|
###select/2##
|
|
###select/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>select(Context::<a href="#type-context">context()</a>, Pat::<a href="#type-sel_pattern">sel_pattern()</a>) -> [{Key, Pid, Value}]</pre>
|
|
<pre>select(Context::<a href="#type-context">context()</a>, Pat::<a href="#type-sel_pattern">sel_pattern()</a>) -> [{Key, Pid, Value}]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Perform a select operation with limited context on the process registry
|
|
|
|
|
|
|
|
|
|
-Perform a select operation with limited context on the process registry
|
|
|
|
|
|
|
|
The physical representation in the registry may differ from the above,
|
|
The physical representation in the registry may differ from the above,
|
|
-but the select patterns are transformed appropriately.Note that limiting the context is just a convenience function, allowing you
|
|
|
|
|
|
+but the select patterns are transformed appropriately.
|
|
|
|
+
|
|
|
|
+Note that limiting the context is just a convenience function, allowing you
|
|
to write a simpler select pattern and still avoid searching the entire
|
|
to write a simpler select pattern and still avoid searching the entire
|
|
registry. Whenever variables are used in the head pattern, this will result
|
|
registry. Whenever variables are used in the head pattern, this will result
|
|
in a wider scan, even if the values are restricted through a guard (e.g.
|
|
in a wider scan, even if the values are restricted through a guard (e.g.
|
|
@@ -1099,61 +965,51 @@ that the scan is limited.<a name="select-3"></a>
|
|
###select/3##
|
|
###select/3##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>select(Context::<a href="#type-context">context()</a>, Pat::<a href="#type-sel_patten">sel_patten()</a>, Limit::integer()) -> {[Match], Continuation} | '$end_of_table'</pre>
|
|
<pre>select(Context::<a href="#type-context">context()</a>, Pat::<a href="#type-sel_patten">sel_patten()</a>, Limit::integer()) -> {[Match], Continuation} | '$end_of_table'</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Like [`select/2`](#select-2) but returns Limit objects at a time.
|
|
|
|
|
|
-
|
|
|
|
-Like [`select/2`](#select-2) but returns Limit objects at a time.See [`http://www.erlang.org/doc/man/ets.html#select-3`](http://www.erlang.org/doc/man/ets.html#select-3).<a name="select_count-1"></a>
|
|
|
|
|
|
+See [`http://www.erlang.org/doc/man/ets.html#select-3`](http://www.erlang.org/doc/man/ets.html#select-3).<a name="select_count-1"></a>
|
|
|
|
|
|
###select_count/1##
|
|
###select_count/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>select_count(Pat::<a href="#type-sel_pattern">sel_pattern()</a>) -> [<a href="#type-sel_object">sel_object()</a>]</pre>
|
|
<pre>select_count(Pat::<a href="#type-sel_pattern">sel_pattern()</a>) -> [<a href="#type-sel_object">sel_object()</a>]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`select_count(all, Pat)`](#select_count-2).<a name="select_count-2"></a>
|
|
Equivalent to [`select_count(all, Pat)`](#select_count-2).<a name="select_count-2"></a>
|
|
|
|
|
|
###select_count/2##
|
|
###select_count/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>select_count(Context::<a href="#type-context">context()</a>, Pat::<a href="#type-sel_pattern">sel_pattern()</a>) -> [{Key, Pid, Value}]</pre>
|
|
<pre>select_count(Context::<a href="#type-context">context()</a>, Pat::<a href="#type-sel_pattern">sel_pattern()</a>) -> [{Key, Pid, Value}]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Perform a select_count operation on the process registry.
|
|
|
|
|
|
-
|
|
|
|
-Perform a select_count operation on the process registry.The physical representation in the registry may differ from the above,
|
|
|
|
|
|
+The physical representation in the registry may differ from the above,
|
|
but the select patterns are transformed appropriately.<a name="send-2"></a>
|
|
but the select patterns are transformed appropriately.<a name="send-2"></a>
|
|
|
|
|
|
###send/2##
|
|
###send/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>send(Key::<a href="#type-key">key()</a>, Msg::any()) -> Msg</pre>
|
|
<pre>send(Key::<a href="#type-key">key()</a>, Msg::any()) -> Msg</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Sends a message to the process, or processes, corresponding to Key.
|
|
|
|
|
|
-
|
|
|
|
-Sends a message to the process, or processes, corresponding to Key.If Key belongs to a unique object (name or aggregated counter), this
|
|
|
|
|
|
+If Key belongs to a unique object (name or aggregated counter), this
|
|
function will send a message to the corresponding process, or fail if there
|
|
function will send a message to the corresponding process, or fail if there
|
|
is no such process. If Key is for a non-unique object type (counter or
|
|
is no such process. If Key is for a non-unique object type (counter or
|
|
property), Msg will be send to all processes that have such an object.<a name="set_env-5"></a>
|
|
property), Msg will be send to all processes that have such an object.<a name="set_env-5"></a>
|
|
@@ -1161,21 +1017,21 @@ property), Msg will be send to all processes that have such an object.<a name="s
|
|
###set_env/5##
|
|
###set_env/5##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>set_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom(), Value::term(), Strategy) -> Value</pre>
|
|
<pre>set_env(Scope::<a href="#type-scope">scope()</a>, App::atom(), Key::atom(), Value::term(), Strategy) -> Value</pre>
|
|
<ul class="definitions"><li><pre>Strategy = [Alternative]</pre></li><li><pre>Alternative = app_env | os_env | {os_env, VAR} | {mnesia, ActivityType, Oid, Pos}</pre></li></ul>
|
|
<ul class="definitions"><li><pre>Strategy = [Alternative]</pre></li><li><pre>Alternative = app_env | os_env | {os_env, VAR} | {mnesia, ActivityType, Oid, Pos}</pre></li></ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Updates the cached value as well as underlying environment.
|
|
|
|
|
|
|
|
|
|
-Updates the cached value as well as underlying environment.
|
|
|
|
|
|
|
|
This function should be exercised with caution, as it affects the larger
|
|
This function should be exercised with caution, as it affects the larger
|
|
environment outside gproc. This function modifies the cached value, and then
|
|
environment outside gproc. This function modifies the cached value, and then
|
|
proceeds to update the underlying environment (OS environment variable or
|
|
proceeds to update the underlying environment (OS environment variable or
|
|
-application environment variable).When the `mnesia` alternative is used, gproc will try to update any existing
|
|
|
|
|
|
+application environment variable).
|
|
|
|
+
|
|
|
|
+When the `mnesia` alternative is used, gproc will try to update any existing
|
|
object, changing only the `Pos` position. If no such object exists, it will
|
|
object, changing only the `Pos` position. If no such object exists, it will
|
|
create a new object, setting any other attributes (except `Pos` and the key)
|
|
create a new object, setting any other attributes (except `Pos` and the key)
|
|
to `undefined`.<a name="set_value-2"></a>
|
|
to `undefined`.<a name="set_value-2"></a>
|
|
@@ -1183,75 +1039,61 @@ to `undefined`.<a name="set_value-2"></a>
|
|
###set_value/2##
|
|
###set_value/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>set_value(Key::<a href="#type-key">key()</a>, Value) -> true</pre>
|
|
<pre>set_value(Key::<a href="#type-key">key()</a>, Value) -> true</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Sets the value of the registeration entry given by Key
|
|
|
|
|
|
|
|
|
|
-Sets the value of the registeration entry given by Key
|
|
|
|
|
|
|
|
Key is assumed to exist and belong to the calling process.
|
|
Key is assumed to exist and belong to the calling process.
|
|
-If it doesn't, this function will exit.Value can be any term, unless the object is a counter, in which case
|
|
|
|
|
|
+If it doesn't, this function will exit.
|
|
|
|
+
|
|
|
|
+Value can be any term, unless the object is a counter, in which case
|
|
it must be an integer.<a name="start_link-0"></a>
|
|
it must be an integer.<a name="start_link-0"></a>
|
|
|
|
|
|
###start_link/0##
|
|
###start_link/0##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>start_link() -> {ok, pid()}</pre>
|
|
<pre>start_link() -> {ok, pid()}</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Starts the gproc server.
|
|
|
|
|
|
-
|
|
|
|
-Starts the gproc server.This function is intended to be called from gproc_sup, as part of
|
|
|
|
|
|
+This function is intended to be called from gproc_sup, as part of
|
|
starting the gproc application.<a name="table-0"></a>
|
|
starting the gproc application.<a name="table-0"></a>
|
|
|
|
|
|
###table/0##
|
|
###table/0##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>table() -> any()</pre>
|
|
<pre>table() -> any()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`table({all, all})`](#table-1).<a name="table-1"></a>
|
|
Equivalent to [`table({all, all})`](#table-1).<a name="table-1"></a>
|
|
|
|
|
|
###table/1##
|
|
###table/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>table(Context::<a href="#type-context">context()</a>) -> any()</pre>
|
|
<pre>table(Context::<a href="#type-context">context()</a>) -> any()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to [`table(Context, [])`](#table-2).<a name="table-2"></a>
|
|
Equivalent to [`table(Context, [])`](#table-2).<a name="table-2"></a>
|
|
|
|
|
|
###table/2##
|
|
###table/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>table(Context::<a href="#type-context">context()</a>, Opts) -> any()</pre>
|
|
<pre>table(Context::<a href="#type-context">context()</a>, Opts) -> any()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
QLC table generator for the gproc registry.
|
|
QLC table generator for the gproc registry.
|
|
Context specifies which subset of the registry should be queried.
|
|
Context specifies which subset of the registry should be queried.
|
|
See [`http://www.erlang.org/doc/man/qlc.html`](http://www.erlang.org/doc/man/qlc.html).<a name="unreg-1"></a>
|
|
See [`http://www.erlang.org/doc/man/qlc.html`](http://www.erlang.org/doc/man/qlc.html).<a name="unreg-1"></a>
|
|
@@ -1259,83 +1101,69 @@ See [`http://www.erlang.org/doc/man/qlc.html`](http://www.erlang.org/doc/man/qlc
|
|
###unreg/1##
|
|
###unreg/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>unreg(Key::<a href="#type-key">key()</a>) -> true</pre>
|
|
<pre>unreg(Key::<a href="#type-key">key()</a>) -> true</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Unregister a name or property.<a name="unreg_shared-1"></a>
|
|
Unregister a name or property.<a name="unreg_shared-1"></a>
|
|
|
|
|
|
###unreg_shared/1##
|
|
###unreg_shared/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>unreg_shared(Key::<a href="#type-key">key()</a>) -> true</pre>
|
|
<pre>unreg_shared(Key::<a href="#type-key">key()</a>) -> true</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Unregister a shared resource.<a name="unregister_name-1"></a>
|
|
Unregister a shared resource.<a name="unregister_name-1"></a>
|
|
|
|
|
|
###unregister_name/1##
|
|
###unregister_name/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`unregister_name(Key) -> any()`
|
|
`unregister_name(Key) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to `unreg / 1`.<a name="update_counter-2"></a>
|
|
Equivalent to `unreg / 1`.<a name="update_counter-2"></a>
|
|
|
|
|
|
###update_counter/2##
|
|
###update_counter/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>update_counter(Key::<a href="#type-key">key()</a>, Incr::<a href="#type-increment">increment()</a>) -> integer()</pre>
|
|
<pre>update_counter(Key::<a href="#type-key">key()</a>, Incr::<a href="#type-increment">increment()</a>) -> integer()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Updates the counter registered as Key for the current process.
|
|
|
|
|
|
|
|
|
|
-Updates the counter registered as Key for the current process.
|
|
|
|
|
|
|
|
This function works almost exactly like ets:update_counter/3
|
|
This function works almost exactly like ets:update_counter/3
|
|
(see [`http://www.erlang.org/doc/man/ets.html#update_counter-3`](http://www.erlang.org/doc/man/ets.html#update_counter-3)), but
|
|
(see [`http://www.erlang.org/doc/man/ets.html#update_counter-3`](http://www.erlang.org/doc/man/ets.html#update_counter-3)), but
|
|
-will fail if the type of object referred to by Key is not a counter.Aggregated counters with the same name will be updated automatically.
|
|
|
|
|
|
+will fail if the type of object referred to by Key is not a counter.
|
|
|
|
+
|
|
|
|
+Aggregated counters with the same name will be updated automatically.
|
|
The `UpdateOp` patterns are the same as for `ets:update_counter/3`, except
|
|
The `UpdateOp` patterns are the same as for `ets:update_counter/3`, except
|
|
that the position is omitted; in gproc, the value position is always `3`.<a name="update_counters-2"></a>
|
|
that the position is omitted; in gproc, the value position is always `3`.<a name="update_counters-2"></a>
|
|
|
|
|
|
###update_counters/2##
|
|
###update_counters/2##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>update_counters(X1::<a href="#type-scope">scope()</a>, Cs::[{<a href="#type-key">key()</a>, pid(), <a href="#type-increment">increment()</a>}]) -> [{<a href="#type-key">key()</a>, pid(), integer()}]</pre>
|
|
<pre>update_counters(X1::<a href="#type-scope">scope()</a>, Cs::[{<a href="#type-key">key()</a>, pid(), <a href="#type-increment">increment()</a>}]) -> [{<a href="#type-key">key()</a>, pid(), integer()}]</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Update a list of counters
|
|
|
|
|
|
|
|
|
|
-Update a list of counters
|
|
|
|
|
|
|
|
This function is not atomic, except (in a sense) for global counters. For local counters,
|
|
This function is not atomic, except (in a sense) for global counters. For local counters,
|
|
it is more of a convenience function. For global counters, it is much more efficient
|
|
it is more of a convenience function. For global counters, it is much more efficient
|
|
-than calling `gproc:update_counter/2` for each individual counter.The return value is the corresponding list of `[{Counter, Pid, NewValue}]`.<a name="update_shared_counter-2"></a>
|
|
|
|
-
|
|
|
|
-###update_shared_counter/2##
|
|
|
|
|
|
+than calling `gproc:update_counter/2` for each individual counter.
|
|
|
|
|
|
|
|
+The return value is the corresponding list of `[{Counter, Pid, NewValue}]`.<a name="update_shared_counter-2"></a>
|
|
|
|
|
|
|
|
+###update_shared_counter/2##
|
|
|
|
|
|
|
|
|
|
<pre>update_shared_counter(Key::<a href="#type-key">key()</a>, Incr) -> integer() | [integer()]</pre>
|
|
<pre>update_shared_counter(Key::<a href="#type-key">key()</a>, Incr) -> integer() | [integer()]</pre>
|
|
@@ -1343,40 +1171,36 @@ than calling `gproc:update_counter/2` for each individual counter.The return val
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Updates the shared counter registered as Key.
|
|
|
|
|
|
|
|
|
|
-Updates the shared counter registered as Key.
|
|
|
|
|
|
|
|
This function works almost exactly like ets:update_counter/3
|
|
This function works almost exactly like ets:update_counter/3
|
|
(see [`http://www.erlang.org/doc/man/ets.html#update_counter-3`](http://www.erlang.org/doc/man/ets.html#update_counter-3)), but
|
|
(see [`http://www.erlang.org/doc/man/ets.html#update_counter-3`](http://www.erlang.org/doc/man/ets.html#update_counter-3)), but
|
|
-will fail if the type of object referred to by Key is not a counter.Aggregated counters with the same name will be updated automatically.
|
|
|
|
|
|
+will fail if the type of object referred to by Key is not a counter.
|
|
|
|
+
|
|
|
|
+Aggregated counters with the same name will be updated automatically.
|
|
The `UpdateOp` patterns are the same as for `ets:update_counter/3`, except
|
|
The `UpdateOp` patterns are the same as for `ets:update_counter/3`, except
|
|
that the position is omitted; in gproc, the value position is always `3`.<a name="where-1"></a>
|
|
that the position is omitted; in gproc, the value position is always `3`.<a name="where-1"></a>
|
|
|
|
|
|
###where/1##
|
|
###where/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<pre>where(Key::<a href="#type-key">key()</a>) -> pid()</pre>
|
|
<pre>where(Key::<a href="#type-key">key()</a>) -> pid()</pre>
|
|
<br></br>
|
|
<br></br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+Returns the pid registered as Key
|
|
|
|
|
|
-
|
|
|
|
-Returns the pid registered as KeyThe type of registration entry must be either name or aggregated counter.
|
|
|
|
|
|
+The type of registration entry must be either name or aggregated counter.
|
|
Otherwise this function will exit. Use [`lookup_pids/1`](#lookup_pids-1) in these
|
|
Otherwise this function will exit. Use [`lookup_pids/1`](#lookup_pids-1) in these
|
|
cases.<a name="whereis_name-1"></a>
|
|
cases.<a name="whereis_name-1"></a>
|
|
|
|
|
|
###whereis_name/1##
|
|
###whereis_name/1##
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
`whereis_name(Key) -> any()`
|
|
`whereis_name(Key) -> any()`
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Equivalent to `where / 1`.
|
|
Equivalent to `where / 1`.
|