module-src_common.html 17 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345
  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">Members</h3>
  32. <h4 class="name" id=".logger"><span class="type-signature">(static) </span>logger<span class="type-signature"></span></h4>
  33. <div class="description">
  34. The logger object for the gRPC module. Defaults to console.
  35. </div>
  36. <dl class="details">
  37. <dt class="tag-source">Source:</dt>
  38. <dd class="tag-source"><ul class="dummy"><li>
  39. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line164">line 164</a>
  40. </li></ul></dd>
  41. </dl>
  42. <h4 class="name" id=".logVerbosity"><span class="type-signature">(static) </span>logVerbosity<span class="type-signature"></span></h4>
  43. <div class="description">
  44. The current logging verbosity. 0 corresponds to logging everything
  45. </div>
  46. <dl class="details">
  47. <dt class="tag-source">Source:</dt>
  48. <dd class="tag-source"><ul class="dummy"><li>
  49. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line169">line 169</a>
  50. </li></ul></dd>
  51. </dl>
  52. <h3 class="subsection-title">Methods</h3>
  53. <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>
  54. <div class="description">
  55. Get a function that deserializes a specific type of protobuf.
  56. </div>
  57. <h5>Parameters:</h5>
  58. <table class="params">
  59. <thead>
  60. <tr>
  61. <th>Name</th>
  62. <th>Type</th>
  63. <th>Attributes</th>
  64. <th class="last">Description</th>
  65. </tr>
  66. </thead>
  67. <tbody>
  68. <tr>
  69. <td class="name"><code>cls</code></td>
  70. <td class="type">
  71. <span class="param-type">function</span>
  72. </td>
  73. <td class="attributes">
  74. </td>
  75. <td class="description last">The constructor of the message type to deserialize</td>
  76. </tr>
  77. <tr>
  78. <td class="name"><code>binaryAsBase64</code></td>
  79. <td class="type">
  80. <span class="param-type">bool</span>
  81. </td>
  82. <td class="attributes">
  83. &lt;optional><br>
  84. </td>
  85. <td class="description last">Deserialize bytes fields as base64 strings
  86. instead of Buffers. Defaults to false</td>
  87. </tr>
  88. <tr>
  89. <td class="name"><code>longsAsStrings</code></td>
  90. <td class="type">
  91. <span class="param-type">bool</span>
  92. </td>
  93. <td class="attributes">
  94. &lt;optional><br>
  95. </td>
  96. <td class="description last">Deserialize long values as strings instead of
  97. objects. Defaults to true</td>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <dl class="details">
  102. <dt class="tag-source">Source:</dt>
  103. <dd class="tag-source"><ul class="dummy"><li>
  104. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line53">line 53</a>
  105. </li></ul></dd>
  106. </dl>
  107. <h5>Returns:</h5>
  108. <div class="param-desc">
  109. The deserialization function
  110. </div>
  111. <dl>
  112. <dt>
  113. Type
  114. </dt>
  115. <dd>
  116. <span class="param-type">function</span>
  117. </dd>
  118. </dl>
  119. <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>
  120. <div class="description">
  121. Get the fully qualified (dotted) name of a ProtoBuf.Reflect value.
  122. </div>
  123. <h5>Parameters:</h5>
  124. <table class="params">
  125. <thead>
  126. <tr>
  127. <th>Name</th>
  128. <th>Type</th>
  129. <th class="last">Description</th>
  130. </tr>
  131. </thead>
  132. <tbody>
  133. <tr>
  134. <td class="name"><code>value</code></td>
  135. <td class="type">
  136. <span class="param-type">ProtoBuf.Reflect.Namespace</span>
  137. </td>
  138. <td class="description last">The value to get the name of</td>
  139. </tr>
  140. </tbody>
  141. </table>
  142. <dl class="details">
  143. <dt class="tag-source">Source:</dt>
  144. <dd class="tag-source"><ul class="dummy"><li>
  145. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line98">line 98</a>
  146. </li></ul></dd>
  147. </dl>
  148. <h5>Returns:</h5>
  149. <div class="param-desc">
  150. The fully qualified name of the value
  151. </div>
  152. <dl>
  153. <dt>
  154. Type
  155. </dt>
  156. <dd>
  157. <span class="param-type">string</span>
  158. </dd>
  159. </dl>
  160. <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>
  161. <div class="description">
  162. Return a map from method names to method attributes for the service.
  163. </div>
  164. <h5>Parameters:</h5>
  165. <table class="params">
  166. <thead>
  167. <tr>
  168. <th>Name</th>
  169. <th>Type</th>
  170. <th>Attributes</th>
  171. <th class="last">Description</th>
  172. </tr>
  173. </thead>
  174. <tbody>
  175. <tr>
  176. <td class="name"><code>service</code></td>
  177. <td class="type">
  178. <span class="param-type">ProtoBuf.Reflect.Service</span>
  179. </td>
  180. <td class="attributes">
  181. </td>
  182. <td class="description last">The service to get attributes for</td>
  183. </tr>
  184. <tr>
  185. <td class="name"><code>options</code></td>
  186. <td class="type">
  187. <span class="param-type">Object</span>
  188. </td>
  189. <td class="attributes">
  190. &lt;optional><br>
  191. </td>
  192. <td class="description last">Options to apply to these attributes</td>
  193. </tr>
  194. </tbody>
  195. </table>
  196. <dl class="details">
  197. <dt class="tag-source">Source:</dt>
  198. <dd class="tag-source"><ul class="dummy"><li>
  199. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line136">line 136</a>
  200. </li></ul></dd>
  201. </dl>
  202. <h5>Returns:</h5>
  203. <div class="param-desc">
  204. The attributes map
  205. </div>
  206. <dl>
  207. <dt>
  208. Type
  209. </dt>
  210. <dd>
  211. <span class="param-type">Object</span>
  212. </dd>
  213. </dl>
  214. <h4 class="name" id=".log"><span class="type-signature">(static) </span>log<span class="signature">(severity, message)</span><span class="type-signature"></span></h4>
  215. <div class="description">
  216. Log a message if the severity is at least as high as the current verbosity
  217. </div>
  218. <h5>Parameters:</h5>
  219. <table class="params">
  220. <thead>
  221. <tr>
  222. <th>Name</th>
  223. <th>Type</th>
  224. <th class="last">Description</th>
  225. </tr>
  226. </thead>
  227. <tbody>
  228. <tr>
  229. <td class="name"><code>severity</code></td>
  230. <td class="type">
  231. <span class="param-type">Number</span>
  232. </td>
  233. <td class="description last">A value of the grpc.logVerbosity map</td>
  234. </tr>
  235. <tr>
  236. <td class="name"><code>message</code></td>
  237. <td class="type">
  238. <span class="param-type">String</span>
  239. </td>
  240. <td class="description last">The message to log</td>
  241. </tr>
  242. </tbody>
  243. </table>
  244. <dl class="details">
  245. <dt class="tag-source">Source:</dt>
  246. <dd class="tag-source"><ul class="dummy"><li>
  247. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line176">line 176</a>
  248. </li></ul></dd>
  249. </dl>
  250. <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>
  251. <div class="description">
  252. Get a function that serializes objects to a buffer by protobuf class.
  253. </div>
  254. <h5>Parameters:</h5>
  255. <table class="params">
  256. <thead>
  257. <tr>
  258. <th>Name</th>
  259. <th>Type</th>
  260. <th class="last">Description</th>
  261. </tr>
  262. </thead>
  263. <tbody>
  264. <tr>
  265. <td class="name"><code>Cls</code></td>
  266. <td class="type">
  267. <span class="param-type">function</span>
  268. </td>
  269. <td class="description last">The constructor of the message type to serialize</td>
  270. </tr>
  271. </tbody>
  272. </table>
  273. <dl class="details">
  274. <dt class="tag-source">Source:</dt>
  275. <dd class="tag-source"><ul class="dummy"><li>
  276. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line80">line 80</a>
  277. </li></ul></dd>
  278. </dl>
  279. <h5>Returns:</h5>
  280. <div class="param-desc">
  281. The serialization function
  282. </div>
  283. <dl>
  284. <dt>
  285. Type
  286. </dt>
  287. <dd>
  288. <span class="param-type">function</span>
  289. </dd>
  290. </dl>
  291. <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>
  292. <div class="description">
  293. Wrap a function to pass null-like values through without calling it. If no
  294. function is given, just uses the identity;
  295. </div>
  296. <h5>Parameters:</h5>
  297. <table class="params">
  298. <thead>
  299. <tr>
  300. <th>Name</th>
  301. <th>Type</th>
  302. <th>Attributes</th>
  303. <th class="last">Description</th>
  304. </tr>
  305. </thead>
  306. <tbody>
  307. <tr>
  308. <td class="name"><code>func</code></td>
  309. <td class="type">
  310. <span class="param-type">function</span>
  311. </td>
  312. <td class="attributes">
  313. &lt;nullable><br>
  314. </td>
  315. <td class="description last">The function to wrap</td>
  316. </tr>
  317. </tbody>
  318. </table>
  319. <dl class="details">
  320. <dt class="tag-source">Source:</dt>
  321. <dd class="tag-source"><ul class="dummy"><li>
  322. <a href="src_common.js.html">src/common.js</a>, <a href="src_common.js.html#line118">line 118</a>
  323. </li></ul></dd>
  324. </dl>
  325. <h5>Returns:</h5>
  326. <div class="param-desc">
  327. The wrapped function
  328. </div>
  329. <dl>
  330. <dt>
  331. Type
  332. </dt>
  333. <dd>
  334. <span class="param-type">function</span>
  335. </dd>
  336. </dl>
  337. </article>
  338. </section>
  339. </div>
  340. <nav>
  341. <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#logVerbosity">logVerbosity</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#setLogger">setLogger</a></li><li><a href="global.html#setLogVerbosity">setLogVerbosity</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>
  342. </nav>
  343. <br class="clear">
  344. <footer>
  345. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Aug 18 2016 12:19:14 GMT-0700 (PDT)
  346. </footer>
  347. <script> prettyPrint(); </script>
  348. <script src="scripts/linenumber.js"> </script>
  349. </body>
  350. </html>