gproc.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Module gproc</title>
  5. <link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
  6. </head>
  7. <body bgcolor="white">
  8. <div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  9. <hr>
  10. <h1>Module gproc</h1>
  11. <ul class="index"><li><a href="#description">Description</a></li><li><a href="#types">Data Types</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Extended process registry.
  12. <p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
  13. <p><b>Authors:</b> Ulf Wiger (<a href="mailto:ulf.wiger@ericsson.com"><tt>ulf.wiger@ericsson.com</tt></a>).</p>
  14. <h2><a name="description">Description</a></h2>Extended process registry
  15. <p>This module implements an extended process registry</p>
  16. <p>For a detailed description, see gproc/doc/erlang07-wiger.pdf.</p>
  17. <h2><a name="types">Data Types</a></h2>
  18. <h3 class="typedecl"><a name="type-context">context()</a></h3>
  19. <p><tt>context() = {<a href="#type-scope">scope()</a>, <a href="#type-type">type()</a>} | <a href="#type-type">type()</a></tt></p>
  20. <p>Local scope is the default</p>
  21. <h3 class="typedecl"><a name="type-headpat">headpat()</a></h3>
  22. <p><tt>headpat() = {<a href="#type-keypat">keypat()</a>, <a href="#type-pidpat">pidpat()</a>, ValPat}</tt></p>
  23. <h3 class="typedecl"><a name="type-key">key()</a></h3>
  24. <p><tt>key() = {<a href="#type-type">type()</a>, <a href="#type-scope">scope()</a>, any()}</tt></p>
  25. <h3 class="typedecl"><a name="type-keypat">keypat()</a></h3>
  26. <p><tt>keypat() = {<a href="#type-sel_type">sel_type()</a> | <a href="#type-sel_var">sel_var()</a>, l | g | <a href="#type-sel_var">sel_var()</a>, any()}</tt></p>
  27. <h3 class="typedecl"><a name="type-pidpat">pidpat()</a></h3>
  28. <p><tt>pidpat() = pid() | <a href="#type-sel_var">sel_var()</a></tt></p>
  29. <p>sel_var() = DollarVar | '_'.</p>
  30. <h3 class="typedecl"><a name="type-scope">scope()</a></h3>
  31. <p><tt>scope() = l | g</tt></p>
  32. <p>l = local registration; g = global registration</p>
  33. <h3 class="typedecl"><a name="type-sel_pattern">sel_pattern()</a></h3>
  34. <p><tt>sel_pattern() = [{<a href="#type-headpat">headpat()</a>, Guards, Prod}]</tt></p>
  35. <h3 class="typedecl"><a name="type-sel_type">sel_type()</a></h3>
  36. <p><tt>sel_type() = n | p | c | a | names | props | counters | aggr_counters</tt></p>
  37. <h3 class="typedecl"><a name="type-type">type()</a></h3>
  38. <p><tt>type() = n | p | c | a</tt></p>
  39. <p>n = name; p = property; c = counter;
  40. a = aggregate_counter</p>
  41. <h2><a name="index">Function Index</a></h2>
  42. <table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add_global_aggr_counter-1">add_global_aggr_counter/1</a></td><td>Registers a global (unique) aggregated counter.</td></tr>
  43. <tr><td valign="top"><a href="#add_global_counter-2">add_global_counter/2</a></td><td>Registers a global (non-unique) counter.</td></tr>
  44. <tr><td valign="top"><a href="#add_global_name-1">add_global_name/1</a></td><td>Registers a global (unique) name.</td></tr>
  45. <tr><td valign="top"><a href="#add_global_property-2">add_global_property/2</a></td><td>Registers a global (non-unique) property.</td></tr>
  46. <tr><td valign="top"><a href="#add_local_aggr_counter-1">add_local_aggr_counter/1</a></td><td>Registers a local (unique) aggregated counter.</td></tr>
  47. <tr><td valign="top"><a href="#add_local_counter-2">add_local_counter/2</a></td><td>Registers a local (non-unique) counter.</td></tr>
  48. <tr><td valign="top"><a href="#add_local_name-1">add_local_name/1</a></td><td>Registers a local (unique) name.</td></tr>
  49. <tr><td valign="top"><a href="#add_local_property-2">add_local_property/2</a></td><td>Registers a local (non-unique) property.</td></tr>
  50. <tr><td valign="top"><a href="#first-1">first/1</a></td><td>Behaves as ets:first(Tab) for a given type of registration object.</td></tr>
  51. <tr><td valign="top"><a href="#get_value-1">get_value/1</a></td><td>Read the value stored with a key registered to the current process.</td></tr>
  52. <tr><td valign="top"><a href="#info-1">info/1</a></td><td>Similar to <code>process_info(Pid)</code> but with additional gproc info.</td></tr>
  53. <tr><td valign="top"><a href="#info-2">info/2</a></td><td>Similar to process_info(Pid, Item), but with additional gproc info.</td></tr>
  54. <tr><td valign="top"><a href="#last-1">last/1</a></td><td>Behaves as ets:last(Tab) for a given type of registration object.</td></tr>
  55. <tr><td valign="top"><a href="#lookup_global_aggr_counter-1">lookup_global_aggr_counter/1</a></td><td>Lookup a global (unique) aggregated counter and returns its value.</td></tr>
  56. <tr><td valign="top"><a href="#lookup_global_counters-1">lookup_global_counters/1</a></td><td>Look up all global (non-unique) instances of a given Counter.</td></tr>
  57. <tr><td valign="top"><a href="#lookup_global_name-1">lookup_global_name/1</a></td><td>Lookup a global unique name.</td></tr>
  58. <tr><td valign="top"><a href="#lookup_global_properties-1">lookup_global_properties/1</a></td><td>Look up all global (non-unique) instances of a given Property.</td></tr>
  59. <tr><td valign="top"><a href="#lookup_local_aggr_counter-1">lookup_local_aggr_counter/1</a></td><td>Lookup a local (unique) aggregated counter and returns its value.</td></tr>
  60. <tr><td valign="top"><a href="#lookup_local_counters-1">lookup_local_counters/1</a></td><td>Look up all local (non-unique) instances of a given Counter.</td></tr>
  61. <tr><td valign="top"><a href="#lookup_local_name-1">lookup_local_name/1</a></td><td>Lookup a local unique name.</td></tr>
  62. <tr><td valign="top"><a href="#lookup_local_properties-1">lookup_local_properties/1</a></td><td>Look up all local (non-unique) instances of a given Property.</td></tr>
  63. <tr><td valign="top"><a href="#lookup_pid-1">lookup_pid/1</a></td><td>Lookup the Pid stored with a key.</td></tr>
  64. <tr><td valign="top"><a href="#lookup_pids-1">lookup_pids/1</a></td><td>Returns a list of pids with the published key Key.</td></tr>
  65. <tr><td valign="top"><a href="#lookup_values-1">lookup_values/1</a></td><td></td></tr>
  66. <tr><td valign="top"><a href="#mreg-3">mreg/3</a></td><td>Register multiple {Key,Value} pairs of a given type and scope.</td></tr>
  67. <tr><td valign="top"><a href="#next-2">next/2</a></td><td>Behaves as ets:next(Tab,Key) for a given type of registration object.</td></tr>
  68. <tr><td valign="top"><a href="#prev-2">prev/2</a></td><td>Behaves as ets:prev(Tab,Key) for a given type of registration object.</td></tr>
  69. <tr><td valign="top"><a href="#reg-1">reg/1</a></td><td>Equivalent to <a href="#reg-2"><tt>reg(Key, undefined)</tt></a>.
  70. </td></tr>
  71. <tr><td valign="top"><a href="#reg-2">reg/2</a></td><td>Register a name or property for the current process.</td></tr>
  72. <tr><td valign="top"><a href="#select-1">select/1</a></td><td>Equivalent to <a href="#select-2"><tt>select(all, Pat)</tt></a>.
  73. </td></tr>
  74. <tr><td valign="top"><a href="#select-2">select/2</a></td><td>Perform a select operation on the process registry.</td></tr>
  75. <tr><td valign="top"><a href="#select-3">select/3</a></td><td>Like <a href="#select-2"><code>select/2</code></a> but returns Limit objects at a time.</td></tr>
  76. <tr><td valign="top"><a href="#send-2">send/2</a></td><td>Sends a message to the process, or processes, corresponding to Key.</td></tr>
  77. <tr><td valign="top"><a href="#set_value-2">set_value/2</a></td><td>Sets the value of the registeration entry given by Key.</td></tr>
  78. <tr><td valign="top"><a href="#start_link-0">start_link/0</a></td><td>Starts the gproc server.</td></tr>
  79. <tr><td valign="top"><a href="#table-1">table/1</a></td><td>Equivalent to <a href="#table-2"><tt>table(Context, [])</tt></a>.
  80. </td></tr>
  81. <tr><td valign="top"><a href="#table-2">table/2</a></td><td>QLC table generator for the gproc registry.</td></tr>
  82. <tr><td valign="top"><a href="#unreg-1">unreg/1</a></td><td>Unregister a name or property.</td></tr>
  83. <tr><td valign="top"><a href="#update_counter-2">update_counter/2</a></td><td>Updates the counter registered as Key for the current process.</td></tr>
  84. <tr><td valign="top"><a href="#where-1">where/1</a></td><td>Returns the pid registered as Key.</td></tr>
  85. </table>
  86. <h2><a name="functions">Function Details</a></h2>
  87. <h3 class="function"><a name="add_global_aggr_counter-1">add_global_aggr_counter/1</a></h3>
  88. <div class="spec">
  89. <p><tt>add_global_aggr_counter(Name) -&gt; any()</tt></p>
  90. </div><p>Equivalent to <a href="#reg-1"><tt>reg({a, l, Name})</tt></a>.</p>
  91. <p>Registers a global (unique) aggregated counter.</p>
  92. <h3 class="function"><a name="add_global_counter-2">add_global_counter/2</a></h3>
  93. <div class="spec">
  94. <p><tt>add_global_counter(Name, Initial) -&gt; any()</tt></p>
  95. </div><p>Registers a global (non-unique) counter. @equiv reg({c,g,Name},Value)</p>
  96. <h3 class="function"><a name="add_global_name-1">add_global_name/1</a></h3>
  97. <div class="spec">
  98. <p><tt>add_global_name(Name) -&gt; any()</tt></p>
  99. </div><p>Registers a global (unique) name. @equiv reg({n,g,Name})</p>
  100. <h3 class="function"><a name="add_global_property-2">add_global_property/2</a></h3>
  101. <div class="spec">
  102. <p><tt>add_global_property(Name, Value) -&gt; any()</tt></p>
  103. </div><p>Registers a global (non-unique) property. @equiv reg({p,g,Name},Value)</p>
  104. <h3 class="function"><a name="add_local_aggr_counter-1">add_local_aggr_counter/1</a></h3>
  105. <div class="spec">
  106. <p><tt>add_local_aggr_counter(Name) -&gt; any()</tt></p>
  107. </div><p>Equivalent to <a href="#reg-1"><tt>reg({a, l, Name})</tt></a>.</p>
  108. <p>Registers a local (unique) aggregated counter.</p>
  109. <h3 class="function"><a name="add_local_counter-2">add_local_counter/2</a></h3>
  110. <div class="spec">
  111. <p><tt>add_local_counter(Name, Initial) -&gt; any()</tt></p>
  112. </div><p>Registers a local (non-unique) counter. @equiv reg({c,l,Name},Value)</p>
  113. <h3 class="function"><a name="add_local_name-1">add_local_name/1</a></h3>
  114. <div class="spec">
  115. <p><tt>add_local_name(Name) -&gt; any()</tt></p>
  116. </div><p>Registers a local (unique) name. @equiv reg({n,l,Name})</p>
  117. <h3 class="function"><a name="add_local_property-2">add_local_property/2</a></h3>
  118. <div class="spec">
  119. <p><tt>add_local_property(Name, Value) -&gt; any()</tt></p>
  120. </div><p>Registers a local (non-unique) property. @equiv reg({p,l,Name},Value)</p>
  121. <h3 class="function"><a name="first-1">first/1</a></h3>
  122. <div class="spec">
  123. <p><tt>first(Type::<a href="#type-type">type()</a>) -&gt; <a href="#type-key">key()</a> | '$end_of_table'</tt></p>
  124. </div><p><p>Behaves as ets:first(Tab) for a given type of registration object.</p>
  125. See <a href="http://www.erlang.org/doc/man/ets.html#first-1" target="_top"><tt>http://www.erlang.org/doc/man/ets.html#first-1</tt></a>.
  126. The registry behaves as an ordered_set table.</p>
  127. <h3 class="function"><a name="get_value-1">get_value/1</a></h3>
  128. <div class="spec">
  129. <p><tt>get_value(Key) -&gt; Value</tt></p>
  130. </div><p><p>Read the value stored with a key registered to the current process.</p>
  131. If no such key is registered to the current process, this function exits.</p>
  132. <h3 class="function"><a name="info-1">info/1</a></h3>
  133. <div class="spec">
  134. <p><tt>info(Pid::pid()) -&gt; ProcessInfo</tt>
  135. <ul class="definitions"><li><tt>ProcessInfo = [{gproc, [{Key, Value}]} | ProcessInfo]</tt></li>
  136. </ul></p>
  137. </div><p><p>Similar to <code>process_info(Pid)</code> but with additional gproc info.</p>
  138. Returns the same information as process_info(Pid), but with the
  139. addition of a <code>gproc</code> information item, containing the <code>{Key,Value}</code>
  140. pairs registered to the process.</p>
  141. <h3 class="function"><a name="info-2">info/2</a></h3>
  142. <div class="spec">
  143. <p><tt>info(Pid::pid(), Item::atom()) -&gt; {Item, Info}</tt></p>
  144. </div><p><p>Similar to process_info(Pid, Item), but with additional gproc info.</p>
  145. For <code>Item = gproc</code>, this function returns a list of <code>{Key, Value}</code> pairs
  146. registered to the process Pid. For other values of Item, it returns the
  147. same as <a href="http://www.erlang.org/doc/man/erlang.html#process_info-2" target="_top"><tt>http://www.erlang.org/doc/man/erlang.html#process_info-2</tt></a>.</p>
  148. <h3 class="function"><a name="last-1">last/1</a></h3>
  149. <div class="spec">
  150. <p><tt>last(Context::<a href="#type-context">context()</a>) -&gt; <a href="#type-key">key()</a> | '$end_of_table'</tt></p>
  151. </div><p><p>Behaves as ets:last(Tab) for a given type of registration object.</p>
  152. See <a href="http://www.erlang.org/doc/man/ets.html#last-1" target="_top"><tt>http://www.erlang.org/doc/man/ets.html#last-1</tt></a>.
  153. The registry behaves as an ordered_set table.</p>
  154. <h3 class="function"><a name="lookup_global_aggr_counter-1">lookup_global_aggr_counter/1</a></h3>
  155. <div class="spec">
  156. <p><tt>lookup_global_aggr_counter(Name::any()) -&gt; integer()</tt></p>
  157. </div><p>Equivalent to <a href="#where-1"><tt>where({a, g, Name})</tt></a>.</p>
  158. <p>Lookup a global (unique) aggregated counter and returns its value.
  159. Fails if there is no such object.</p>
  160. <h3 class="function"><a name="lookup_global_counters-1">lookup_global_counters/1</a></h3>
  161. <div class="spec">
  162. <p><tt>lookup_global_counters(Counter::any()) -&gt; [{pid(), Value::integer()}]</tt></p>
  163. </div><p>Equivalent to <a href="#lookup_values-1"><tt>lookup_values({c, l, Counter})</tt></a>.</p>
  164. <p>Look up all global (non-unique) instances of a given Counter.
  165. Returns a list of {Pid, Value} tuples for all matching objects.</p>
  166. <h3 class="function"><a name="lookup_global_name-1">lookup_global_name/1</a></h3>
  167. <div class="spec">
  168. <p><tt>lookup_global_name(Name::any()) -&gt; pid()</tt></p>
  169. </div><p>Equivalent to <a href="#where-1"><tt>where({n, g, Name})</tt></a>.</p>
  170. <p>Lookup a global unique name. Fails if there is no such name.</p>
  171. <h3 class="function"><a name="lookup_global_properties-1">lookup_global_properties/1</a></h3>
  172. <div class="spec">
  173. <p><tt>lookup_global_properties(Property::any()) -&gt; [{pid(), Value}]</tt></p>
  174. </div><p>Equivalent to <a href="#lookup_values-1"><tt>lookup_values({p, g, Property})</tt></a>.</p>
  175. <p>Look up all global (non-unique) instances of a given Property.
  176. Returns a list of {Pid, Value} tuples for all matching objects.</p>
  177. <h3 class="function"><a name="lookup_local_aggr_counter-1">lookup_local_aggr_counter/1</a></h3>
  178. <div class="spec">
  179. <p><tt>lookup_local_aggr_counter(Name::any()) -&gt; integer()</tt></p>
  180. </div><p>Equivalent to <a href="#where-1"><tt>where({a, l, Name})</tt></a>.</p>
  181. <p>Lookup a local (unique) aggregated counter and returns its value.
  182. Fails if there is no such object.</p>
  183. <h3 class="function"><a name="lookup_local_counters-1">lookup_local_counters/1</a></h3>
  184. <div class="spec">
  185. <p><tt>lookup_local_counters(Counter::any()) -&gt; [{pid(), Value::integer()}]</tt></p>
  186. </div><p>Equivalent to <a href="#lookup_values-1"><tt>lookup_values({c, l, Counter})</tt></a>.</p>
  187. <p>Look up all local (non-unique) instances of a given Counter.
  188. Returns a list of {Pid, Value} tuples for all matching objects.</p>
  189. <h3 class="function"><a name="lookup_local_name-1">lookup_local_name/1</a></h3>
  190. <div class="spec">
  191. <p><tt>lookup_local_name(Name::any()) -&gt; pid()</tt></p>
  192. </div><p>Equivalent to <a href="#where-1"><tt>where({n, l, Name})</tt></a>.</p>
  193. <p>Lookup a local unique name. Fails if there is no such name.</p>
  194. <h3 class="function"><a name="lookup_local_properties-1">lookup_local_properties/1</a></h3>
  195. <div class="spec">
  196. <p><tt>lookup_local_properties(Property::any()) -&gt; [{pid(), Value}]</tt></p>
  197. </div><p>Equivalent to <a href="#lookup_values-1"><tt>lookup_values({p, l, Property})</tt></a>.</p>
  198. <p>Look up all local (non-unique) instances of a given Property.
  199. Returns a list of {Pid, Value} tuples for all matching objects.</p>
  200. <h3 class="function"><a name="lookup_pid-1">lookup_pid/1</a></h3>
  201. <div class="spec">
  202. <p><tt>lookup_pid(Key) -&gt; Pid</tt></p>
  203. </div><p>Lookup the Pid stored with a key.
  204. </p>
  205. <h3 class="function"><a name="lookup_pids-1">lookup_pids/1</a></h3>
  206. <div class="spec">
  207. <p><tt>lookup_pids(Key::<a href="#type-key">key()</a>) -&gt; [pid()]</tt></p>
  208. </div><p><p>Returns a list of pids with the published key Key</p>
  209. If the type of registration entry is either name or aggregated counter,
  210. this function will return either an empty list, or a list of one pid.
  211. For non-unique types, the return value can be a list of any length.</p>
  212. <h3 class="function"><a name="lookup_values-1">lookup_values/1</a></h3>
  213. <div class="spec">
  214. <p><tt>lookup_values(Key) -&gt; any()</tt></p>
  215. </div>
  216. <h3 class="function"><a name="mreg-3">mreg/3</a></h3>
  217. <div class="spec">
  218. <p><tt>mreg(T::<a href="#type-type">type()</a>, X2::<a href="#type-scope">scope()</a>, KVL::[{Key::any(), Value::any()}]) -&gt; true</tt></p>
  219. </div><p><p>Register multiple {Key,Value} pairs of a given type and scope.</p>
  220. This function is more efficient than calling <a href="#reg-2"><code>reg/2</code></a> repeatedly.</p>
  221. <h3 class="function"><a name="next-2">next/2</a></h3>
  222. <div class="spec">
  223. <p><tt>next(Context::<a href="#type-context">context()</a>, Key::<a href="#type-key">key()</a>) -&gt; <a href="#type-key">key()</a> | '$end_of_table'</tt></p>
  224. </div><p><p>Behaves as ets:next(Tab,Key) for a given type of registration object.</p>
  225. See <a href="http://www.erlang.org/doc/man/ets.html#next-2" target="_top"><tt>http://www.erlang.org/doc/man/ets.html#next-2</tt></a>.
  226. The registry behaves as an ordered_set table.</p>
  227. <h3 class="function"><a name="prev-2">prev/2</a></h3>
  228. <div class="spec">
  229. <p><tt>prev(Context::<a href="#type-context">context()</a>, Key::<a href="#type-key">key()</a>) -&gt; <a href="#type-key">key()</a> | '$end_of_table'</tt></p>
  230. </div><p><p>Behaves as ets:prev(Tab,Key) for a given type of registration object.</p>
  231. See <a href="http://www.erlang.org/doc/man/ets.html#prev-2" target="_top"><tt>http://www.erlang.org/doc/man/ets.html#prev-2</tt></a>.
  232. The registry behaves as an ordered_set table.</p>
  233. <h3 class="function"><a name="reg-1">reg/1</a></h3>
  234. <div class="spec">
  235. <p><tt>reg(Key::<a href="#type-key">key()</a>) -&gt; true</tt></p>
  236. </div><p>Equivalent to <a href="#reg-2"><tt>reg(Key, undefined)</tt></a>.</p>
  237. <h3 class="function"><a name="reg-2">reg/2</a></h3>
  238. <div class="spec">
  239. <p><tt>reg(Key::<a href="#type-key">key()</a>, Value) -&gt; true</tt></p>
  240. </div><p><p>Register a name or property for the current process</p>
  241. </p>
  242. <h3 class="function"><a name="select-1">select/1</a></h3>
  243. <div class="spec">
  244. <p><tt>select(Pat::<a href="#type-select_pattern">select_pattern()</a>) -&gt; list(<a href="#type-sel_object">sel_object()</a>)</tt></p>
  245. </div><p>Equivalent to <a href="#select-2"><tt>select(all, Pat)</tt></a>.</p>
  246. <h3 class="function"><a name="select-2">select/2</a></h3>
  247. <div class="spec">
  248. <p><tt>select(Type::<a href="#type-sel_type">sel_type()</a>, Pat::<a href="#type-sel_pattern">sel_pattern()</a>) -&gt; [{Key, Pid, Value}]</tt></p>
  249. </div><p><p>Perform a select operation on the process registry.</p>
  250. The physical representation in the registry may differ from the above,
  251. but the select patterns are transformed appropriately.</p>
  252. <h3 class="function"><a name="select-3">select/3</a></h3>
  253. <div class="spec">
  254. <p><tt>select(Type::<a href="#type-sel_type">sel_type()</a>, Pat::<a href="#type-sel_patten">sel_patten()</a>, Limit::integer()) -&gt; [{Key, Pid, Value}]</tt></p>
  255. </div><p><p>Like <a href="#select-2"><code>select/2</code></a> but returns Limit objects at a time.</p>
  256. See <a href="http://www.erlang.org/doc/man/ets.html#select-3" target="_top"><tt>http://www.erlang.org/doc/man/ets.html#select-3</tt></a>.</p>
  257. <h3 class="function"><a name="send-2">send/2</a></h3>
  258. <div class="spec">
  259. <p><tt>send(Key::<a href="#type-key">key()</a>, Msg::any()) -&gt; Msg</tt></p>
  260. </div><p><p>Sends a message to the process, or processes, corresponding to Key.</p>
  261. If Key belongs to a unique object (name or aggregated counter), this
  262. function will send a message to the corresponding process, or fail if there
  263. is no such process. If Key is for a non-unique object type (counter or
  264. property), Msg will be send to all processes that have such an object.</p>
  265. <h3 class="function"><a name="set_value-2">set_value/2</a></h3>
  266. <div class="spec">
  267. <p><tt>set_value(Key::<a href="#type-key">key()</a>, Value) -&gt; true</tt></p>
  268. </div><p><p>Sets the value of the registeration entry given by Key</p>
  269. <p>Key is assumed to exist and belong to the calling process.
  270. If it doesn't, this function will exit.</p>
  271. Value can be any term, unless the object is a counter, in which case
  272. it must be an integer.</p>
  273. <h3 class="function"><a name="start_link-0">start_link/0</a></h3>
  274. <div class="spec">
  275. <p><tt>start_link() -&gt; {ok, pid()}</tt></p>
  276. </div><p><p>Starts the gproc server.</p>
  277. This function is intended to be called from gproc_sup, as part of
  278. starting the gproc application.</p>
  279. <h3 class="function"><a name="table-1">table/1</a></h3>
  280. <div class="spec">
  281. <p><tt>table(Context::<a href="#type-context">context()</a>) -&gt; any()</tt></p>
  282. </div><p>Equivalent to <a href="#table-2"><tt>table(Context, [])</tt></a>.</p>
  283. <h3 class="function"><a name="table-2">table/2</a></h3>
  284. <div class="spec">
  285. <p><tt>table(Context::<a href="#type-context">context()</a>, Opts) -&gt; any()</tt></p>
  286. </div><p>QLC table generator for the gproc registry.
  287. Context specifies which subset of the registry should be queried.
  288. See <a href="http://www.erlang.org/doc/man/qlc.html" target="_top"><tt>http://www.erlang.org/doc/man/qlc.html</tt></a>.</p>
  289. <h3 class="function"><a name="unreg-1">unreg/1</a></h3>
  290. <div class="spec">
  291. <p><tt>unreg(Key::<a href="#type-key">key()</a>) -&gt; true</tt></p>
  292. </div><p>Unregister a name or property.</p>
  293. <h3 class="function"><a name="update_counter-2">update_counter/2</a></h3>
  294. <div class="spec">
  295. <p><tt>update_counter(Key::<a href="#type-key">key()</a>, Incr::integer()) -&gt; integer()</tt></p>
  296. </div><p><p>Updates the counter registered as Key for the current process.</p>
  297. This function works like ets:update_counter/3
  298. (see <a href="http://www.erlang.org/doc/man/ets.html#update_counter-3" target="_top"><tt>http://www.erlang.org/doc/man/ets.html#update_counter-3</tt></a>), but
  299. will fail if the type of object referred to by Key is not a counter.</p>
  300. <h3 class="function"><a name="where-1">where/1</a></h3>
  301. <div class="spec">
  302. <p><tt>where(Key::<a href="#type-key">key()</a>) -&gt; pid()</tt></p>
  303. </div><p><p>Returns the pid registered as Key</p>
  304. The type of registration entry must be either name or aggregated counter.
  305. Otherwise this function will exit. Use <a href="#lookup_pids-1"><code>lookup_pids/1</code></a> in these
  306. cases.</p>
  307. <hr>
  308. <div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  309. <p><i>Generated by EDoc, Sep 21 2009, 10:14:31.</i></p>
  310. </body>
  311. </html>