module-src_common.html 14 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Module: src/common</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Module: src/common</h1>
  17. <section>
  18. <header>
  19. </header>
  20. <article>
  21. <div class="container-overview">
  22. <div class="description">This module contains functions that are common to client and server
  23. code. None of them should be used directly by gRPC users.</div>
  24. <dl class="details">
  25. <dt class="tag-source">Source:</dt>
  26. <dd class="tag-source"><ul class="dummy"><li>
  27. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line34">line 34</a>
  28. </li></ul></dd>
  29. </dl>
  30. </div>
  31. <h3 class="subsection-title">Methods</h3>
  32. <h4 class="name" id=".deserializeCls"><span class="type-signature">(static) </span>deserializeCls<span class="signature">(cls, binaryAsBase64<span class="signature-attributes">opt</span>, longsAsStrings<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {function}</span></h4>
  33. <div class="description">
  34. Get a function that deserializes a specific type of protobuf.
  35. </div>
  36. <h5>Parameters:</h5>
  37. <table class="params">
  38. <thead>
  39. <tr>
  40. <th>Name</th>
  41. <th>Type</th>
  42. <th>Attributes</th>
  43. <th class="last">Description</th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. <tr>
  48. <td class="name"><code>cls</code></td>
  49. <td class="type">
  50. <span class="param-type">function</span>
  51. </td>
  52. <td class="attributes">
  53. </td>
  54. <td class="description last">The constructor of the message type to deserialize</td>
  55. </tr>
  56. <tr>
  57. <td class="name"><code>binaryAsBase64</code></td>
  58. <td class="type">
  59. <span class="param-type">bool</span>
  60. </td>
  61. <td class="attributes">
  62. &lt;optional><br>
  63. </td>
  64. <td class="description last">Deserialize bytes fields as base64 strings
  65. instead of Buffers. Defaults to false</td>
  66. </tr>
  67. <tr>
  68. <td class="name"><code>longsAsStrings</code></td>
  69. <td class="type">
  70. <span class="param-type">bool</span>
  71. </td>
  72. <td class="attributes">
  73. &lt;optional><br>
  74. </td>
  75. <td class="description last">Deserialize long values as strings instead of
  76. objects. Defaults to true</td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. <dl class="details">
  81. <dt class="tag-source">Source:</dt>
  82. <dd class="tag-source"><ul class="dummy"><li>
  83. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line53">line 53</a>
  84. </li></ul></dd>
  85. </dl>
  86. <h5>Returns:</h5>
  87. <div class="param-desc">
  88. The deserialization function
  89. </div>
  90. <dl>
  91. <dt>
  92. Type
  93. </dt>
  94. <dd>
  95. <span class="param-type">function</span>
  96. </dd>
  97. </dl>
  98. <h4 class="name" id=".fullyQualifiedName"><span class="type-signature">(static) </span>fullyQualifiedName<span class="signature">(value)</span><span class="type-signature"> &rarr; {string}</span></h4>
  99. <div class="description">
  100. Get the fully qualified (dotted) name of a ProtoBuf.Reflect value.
  101. </div>
  102. <h5>Parameters:</h5>
  103. <table class="params">
  104. <thead>
  105. <tr>
  106. <th>Name</th>
  107. <th>Type</th>
  108. <th class="last">Description</th>
  109. </tr>
  110. </thead>
  111. <tbody>
  112. <tr>
  113. <td class="name"><code>value</code></td>
  114. <td class="type">
  115. <span class="param-type">ProtoBuf.Reflect.Namespace</span>
  116. </td>
  117. <td class="description last">The value to get the name of</td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. <dl class="details">
  122. <dt class="tag-source">Source:</dt>
  123. <dd class="tag-source"><ul class="dummy"><li>
  124. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line98">line 98</a>
  125. </li></ul></dd>
  126. </dl>
  127. <h5>Returns:</h5>
  128. <div class="param-desc">
  129. The fully qualified name of the value
  130. </div>
  131. <dl>
  132. <dt>
  133. Type
  134. </dt>
  135. <dd>
  136. <span class="param-type">string</span>
  137. </dd>
  138. </dl>
  139. <h4 class="name" id=".getProtobufServiceAttrs"><span class="type-signature">(static) </span>getProtobufServiceAttrs<span class="signature">(service, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4>
  140. <div class="description">
  141. Return a map from method names to method attributes for the service.
  142. </div>
  143. <h5>Parameters:</h5>
  144. <table class="params">
  145. <thead>
  146. <tr>
  147. <th>Name</th>
  148. <th>Type</th>
  149. <th>Attributes</th>
  150. <th class="last">Description</th>
  151. </tr>
  152. </thead>
  153. <tbody>
  154. <tr>
  155. <td class="name"><code>service</code></td>
  156. <td class="type">
  157. <span class="param-type">ProtoBuf.Reflect.Service</span>
  158. </td>
  159. <td class="attributes">
  160. </td>
  161. <td class="description last">The service to get attributes for</td>
  162. </tr>
  163. <tr>
  164. <td class="name"><code>options</code></td>
  165. <td class="type">
  166. <span class="param-type">Object</span>
  167. </td>
  168. <td class="attributes">
  169. &lt;optional><br>
  170. </td>
  171. <td class="description last">Options to apply to these attributes</td>
  172. </tr>
  173. </tbody>
  174. </table>
  175. <dl class="details">
  176. <dt class="tag-source">Source:</dt>
  177. <dd class="tag-source"><ul class="dummy"><li>
  178. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line136">line 136</a>
  179. </li></ul></dd>
  180. </dl>
  181. <h5>Returns:</h5>
  182. <div class="param-desc">
  183. The attributes map
  184. </div>
  185. <dl>
  186. <dt>
  187. Type
  188. </dt>
  189. <dd>
  190. <span class="param-type">Object</span>
  191. </dd>
  192. </dl>
  193. <h4 class="name" id=".serializeCls"><span class="type-signature">(static) </span>serializeCls<span class="signature">(Cls)</span><span class="type-signature"> &rarr; {function}</span></h4>
  194. <div class="description">
  195. Get a function that serializes objects to a buffer by protobuf class.
  196. </div>
  197. <h5>Parameters:</h5>
  198. <table class="params">
  199. <thead>
  200. <tr>
  201. <th>Name</th>
  202. <th>Type</th>
  203. <th class="last">Description</th>
  204. </tr>
  205. </thead>
  206. <tbody>
  207. <tr>
  208. <td class="name"><code>Cls</code></td>
  209. <td class="type">
  210. <span class="param-type">function</span>
  211. </td>
  212. <td class="description last">The constructor of the message type to serialize</td>
  213. </tr>
  214. </tbody>
  215. </table>
  216. <dl class="details">
  217. <dt class="tag-source">Source:</dt>
  218. <dd class="tag-source"><ul class="dummy"><li>
  219. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line80">line 80</a>
  220. </li></ul></dd>
  221. </dl>
  222. <h5>Returns:</h5>
  223. <div class="param-desc">
  224. The serialization function
  225. </div>
  226. <dl>
  227. <dt>
  228. Type
  229. </dt>
  230. <dd>
  231. <span class="param-type">function</span>
  232. </dd>
  233. </dl>
  234. <h4 class="name" id=".wrapIgnoreNull"><span class="type-signature">(static) </span>wrapIgnoreNull<span class="signature">(func<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {function}</span></h4>
  235. <div class="description">
  236. Wrap a function to pass null-like values through without calling it. If no
  237. function is given, just uses the identity;
  238. </div>
  239. <h5>Parameters:</h5>
  240. <table class="params">
  241. <thead>
  242. <tr>
  243. <th>Name</th>
  244. <th>Type</th>
  245. <th>Attributes</th>
  246. <th class="last">Description</th>
  247. </tr>
  248. </thead>
  249. <tbody>
  250. <tr>
  251. <td class="name"><code>func</code></td>
  252. <td class="type">
  253. <span class="param-type">function</span>
  254. </td>
  255. <td class="attributes">
  256. &lt;nullable><br>
  257. </td>
  258. <td class="description last">The function to wrap</td>
  259. </tr>
  260. </tbody>
  261. </table>
  262. <dl class="details">
  263. <dt class="tag-source">Source:</dt>
  264. <dd class="tag-source"><ul class="dummy"><li>
  265. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line118">line 118</a>
  266. </li></ul></dd>
  267. </dl>
  268. <h5>Returns:</h5>
  269. <div class="param-desc">
  270. The wrapped function
  271. </div>
  272. <dl>
  273. <dt>
  274. Type
  275. </dt>
  276. <dd>
  277. <span class="param-type">function</span>
  278. </dd>
  279. </dl>
  280. </article>
  281. </section>
  282. </div>
  283. <nav>
  284. <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-src_client.html">src/client</a></li><li><a href="module-src_common.html">src/common</a></li><li><a href="module-src_credentials.html">src/credentials</a></li><li><a href="module-src_metadata.html">src/metadata</a></li><li><a href="module-src_server.html">src/server</a></li></ul><h3>Classes</h3><ul><li><a href="module-src_client.makeClientConstructor-Client.html">Client</a></li><li><a href="module-src_client-ClientDuplexStream.html">ClientDuplexStream</a></li><li><a href="module-src_client-ClientReadableStream.html">ClientReadableStream</a></li><li><a href="module-src_client-ClientWritableStream.html">ClientWritableStream</a></li><li><a href="module-src_metadata-Metadata.html">Metadata</a></li><li><a href="module-src_server-Server.html">Server</a></li><li><a href="module-src_server-ServerDuplexStream.html">ServerDuplexStream</a></li><li><a href="module-src_server-ServerReadableStream.html">ServerReadableStream</a></li><li><a href="module-src_server-ServerWritableStream.html">ServerWritableStream</a></li></ul><h3>Global</h3><ul><li><a href="global.html#callError">callError</a></li><li><a href="global.html#credentials">credentials</a></li><li><a href="global.html#getClientChannel">getClientChannel</a></li><li><a href="global.html#load">load</a></li><li><a href="global.html#loadObject">loadObject</a></li><li><a href="global.html#makeGenericClientConstructor">makeGenericClientConstructor</a></li><li><a href="global.html#Metadata">Metadata</a></li><li><a href="global.html#propagate">propagate</a></li><li><a href="global.html#Server">Server</a></li><li><a href="global.html#ServerCredentials">ServerCredentials</a></li><li><a href="global.html#status">status</a></li><li><a href="global.html#waitForClientReady">waitForClientReady</a></li><li><a href="global.html#writeFlags">writeFlags</a></li></ul>
  285. </nav>
  286. <br class="clear">
  287. <footer>
  288. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed May 11 2016 18:17:25 GMT-0700 (PDT)
  289. </footer>
  290. <script> prettyPrint(); </script>
  291. <script src="scripts/linenumber.js"> </script>
  292. </body>
  293. </html>