grpc.Metadata.html 16 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>Documentation Class: Metadata</title>
  7. <!--[if lt IE 9]>
  8. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  9. <![endif]-->
  10. <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
  11. <link type="text/css" rel="stylesheet" href="styles/site.simplex.css">
  12. </head>
  13. <body>
  14. <div class="navbar navbar-default navbar-fixed-top ">
  15. <div class="container">
  16. <div class="navbar-header">
  17. <a class="navbar-brand" href="index.html">Documentation</a>
  18. <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
  19. <span class="icon-bar"></span>
  20. <span class="icon-bar"></span>
  21. <span class="icon-bar"></span>
  22. </button>
  23. </div>
  24. <div class="navbar-collapse collapse" id="topNavigation">
  25. <ul class="nav navbar-nav">
  26. <li class="dropdown">
  27. <a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a>
  28. <ul class="dropdown-menu ">
  29. <li><a href="grpc.html">grpc</a></li><li><a href="grpc.credentials.html">grpc.credentials</a></li>
  30. </ul>
  31. </li>
  32. <li class="dropdown">
  33. <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
  34. <ul class="dropdown-menu ">
  35. <li><a href="grpc.Client.html">grpc.Client</a></li><li><a href="grpc.credentials-CallCredentials.html">grpc.credentials~CallCredentials</a></li><li><a href="grpc.credentials-ChannelCredentials.html">grpc.credentials~ChannelCredentials</a></li><li><a href="grpc.Metadata.html">grpc.Metadata</a></li><li><a href="grpc.Server.html">grpc.Server</a></li><li><a href="grpc.ServerCredentials.html">grpc.ServerCredentials</a></li><li><a href="grpc-ClientDuplexStream.html">grpc~ClientDuplexStream</a></li><li><a href="grpc-ClientReadableStream.html">grpc~ClientReadableStream</a></li><li><a href="grpc-ClientUnaryCall.html">grpc~ClientUnaryCall</a></li><li><a href="grpc-ClientWritableStream.html">grpc~ClientWritableStream</a></li><li><a href="grpc-ServerDuplexStream.html">grpc~ServerDuplexStream</a></li><li><a href="grpc-ServerReadableStream.html">grpc~ServerReadableStream</a></li><li><a href="grpc-ServerUnaryCall.html">grpc~ServerUnaryCall</a></li><li><a href="grpc-ServerWritableStream.html">grpc~ServerWritableStream</a></li>
  36. </ul>
  37. </li>
  38. <li class="dropdown">
  39. <a href="events.list.html" class="dropdown-toggle" data-toggle="dropdown">Events<b class="caret"></b></a>
  40. <ul class="dropdown-menu ">
  41. <li><a href="grpc-ClientDuplexStream.html#event:metadata">grpc~ClientDuplexStream#metadata</a></li><li><a href="grpc-ClientDuplexStream.html#event:status">grpc~ClientDuplexStream#status</a></li><li><a href="grpc-ClientReadableStream.html#event:metadata">grpc~ClientReadableStream#metadata</a></li><li><a href="grpc-ClientReadableStream.html#event:status">grpc~ClientReadableStream#status</a></li><li><a href="grpc-ClientUnaryCall.html#event:metadata">grpc~ClientUnaryCall#event:metadata</a></li><li><a href="grpc-ClientUnaryCall.html#event:status">grpc~ClientUnaryCall#event:status</a></li><li><a href="grpc-ClientWritableStream.html#event:metadata">grpc~ClientWritableStream#metadata</a></li><li><a href="grpc-ClientWritableStream.html#event:status">grpc~ClientWritableStream#status</a></li><li><a href="grpc-ServerDuplexStream.html#~event:cancelled">grpc~ServerDuplexStream~event:cancelled</a></li><li><a href="grpc-ServerReadableStream.html#~event:cancelled">grpc~ServerReadableStream~event:cancelled</a></li><li><a href="grpc-ServerUnaryCall.html#~event:cancelled">grpc~ServerUnaryCall~event:cancelled</a></li><li><a href="grpc-ServerWritableStream.html#~event:cancelled">grpc~ServerWritableStream~event:cancelled</a></li>
  42. </ul>
  43. </li>
  44. <li class="dropdown">
  45. <a href="externals.list.html" class="dropdown-toggle" data-toggle="dropdown">Externals<b class="caret"></b></a>
  46. <ul class="dropdown-menu ">
  47. <li><a href="external-Duplex.html">Duplex</a></li><li><a href="external-EventEmitter.html">EventEmitter</a></li><li><a href="external-GoogleCredential.html">GoogleCredential</a></li><li><a href="external-Readable.html">Readable</a></li><li><a href="external-Writable.html">Writable</a></li>
  48. </ul>
  49. </li>
  50. </ul>
  51. <div class="col-sm-3 col-md-3">
  52. <form class="navbar-form" role="search">
  53. <div class="input-group">
  54. <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
  55. <div class="input-group-btn">
  56. <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
  57. </div>
  58. </div>
  59. </form>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="container" id="toc-content">
  65. <div class="row">
  66. <div class="col-md-8">
  67. <div id="main">
  68. <h1 class="page-title">Class: Metadata</h1>
  69. <section>
  70. <header>
  71. <h2>
  72. <span class="ancestors"><a href="grpc.html">grpc</a>.</span>
  73. Metadata
  74. </h2>
  75. </header>
  76. <article>
  77. <div class="container-overview">
  78. <hr>
  79. <dt>
  80. <h4 class="name" id="Metadata"><span class="type-signature"></span>new Metadata()</h4>
  81. </dt>
  82. <dd>
  83. <div class="description">
  84. <p>Class for storing metadata. Keys are normalized to lowercase ASCII.</p>
  85. </div>
  86. <dl class="details">
  87. </dl>
  88. <h5>Example</h5>
  89. <pre class="sunlight-highlight-javascript">var metadata = new metadata_module.Metadata();
  90. metadata.set(&#x27;key1&#x27;, &#x27;value1&#x27;);
  91. metadata.add(&#x27;key1&#x27;, &#x27;value2&#x27;);
  92. metadata.get(&#x27;key1&#x27;) // returns [&#x27;value1&#x27;, &#x27;value2&#x27;]</pre>
  93. </dd>
  94. </div>
  95. <h3 class="subsection-title">Methods</h3>
  96. <dl>
  97. <hr>
  98. <dt>
  99. <h4 class="name" id="add"><span class="type-signature"></span>add(key, value)</h4>
  100. </dt>
  101. <dd>
  102. <div class="description">
  103. <p>Adds the given value for the given key. Normalizes the key.</p>
  104. </div>
  105. <h5>Parameters:</h5>
  106. <table class="params table table-striped">
  107. <thead>
  108. <tr>
  109. <th>Name</th>
  110. <th>Type</th>
  111. <th class="last">Description</th>
  112. </tr>
  113. </thead>
  114. <tbody>
  115. <tr>
  116. <td class="name"><code>key</code></td>
  117. <td class="type">
  118. <span class="param-type">String</span>
  119. </td>
  120. <td class="description last"><p>The key to add to.</p></td>
  121. </tr>
  122. <tr>
  123. <td class="name"><code>value</code></td>
  124. <td class="type">
  125. <span class="param-type">String</span>
  126. |
  127. <span class="param-type">Buffer</span>
  128. </td>
  129. <td class="description last"><p>The value to add. Must be a buffer if and only
  130. if the normalized key ends with '-bin'</p></td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. <dl class="details">
  135. </dl>
  136. </dd>
  137. <hr>
  138. <dt>
  139. <h4 class="name" id="clone"><span class="type-signature"></span>clone()</h4>
  140. </dt>
  141. <dd>
  142. <div class="description">
  143. <p>Clone the metadata object.</p>
  144. </div>
  145. <dl class="details">
  146. </dl>
  147. <h5>Returns:</h5>
  148. <div class="param-desc">
  149. <p>The new cloned object</p>
  150. </div>
  151. <dl>
  152. <dt>
  153. Type
  154. </dt>
  155. <dd>
  156. <span class="param-type"><a href="grpc.Metadata.html">grpc.Metadata</a></span>
  157. </dd>
  158. </dl>
  159. </dd>
  160. <hr>
  161. <dt>
  162. <h4 class="name" id="get"><span class="type-signature"></span>get(key)</h4>
  163. </dt>
  164. <dd>
  165. <div class="description">
  166. <p>Gets a list of all values associated with the key. Normalizes the key.</p>
  167. </div>
  168. <h5>Parameters:</h5>
  169. <table class="params table table-striped">
  170. <thead>
  171. <tr>
  172. <th>Name</th>
  173. <th>Type</th>
  174. <th class="last">Description</th>
  175. </tr>
  176. </thead>
  177. <tbody>
  178. <tr>
  179. <td class="name"><code>key</code></td>
  180. <td class="type">
  181. <span class="param-type">String</span>
  182. </td>
  183. <td class="description last"><p>The key to get</p></td>
  184. </tr>
  185. </tbody>
  186. </table>
  187. <dl class="details">
  188. </dl>
  189. <h5>Returns:</h5>
  190. <div class="param-desc">
  191. <p>The values associated with that key</p>
  192. </div>
  193. <dl>
  194. <dt>
  195. Type
  196. </dt>
  197. <dd>
  198. <span class="param-type">Array.&lt;(String|Buffer)></span>
  199. </dd>
  200. </dl>
  201. </dd>
  202. <hr>
  203. <dt>
  204. <h4 class="name" id="getMap"><span class="type-signature"></span>getMap()</h4>
  205. </dt>
  206. <dd>
  207. <div class="description">
  208. <p>Get a map of each key to a single associated value. This reflects the most
  209. common way that people will want to see metadata.</p>
  210. </div>
  211. <dl class="details">
  212. </dl>
  213. <h5>Returns:</h5>
  214. <div class="param-desc">
  215. <p>A key/value mapping of the metadata</p>
  216. </div>
  217. <dl>
  218. <dt>
  219. Type
  220. </dt>
  221. <dd>
  222. <span class="param-type">Object.&lt;String, (String|Buffer)></span>
  223. </dd>
  224. </dl>
  225. </dd>
  226. <hr>
  227. <dt>
  228. <h4 class="name" id="remove"><span class="type-signature"></span>remove(key)</h4>
  229. </dt>
  230. <dd>
  231. <div class="description">
  232. <p>Remove the given key and any associated values. Normalizes the key.</p>
  233. </div>
  234. <h5>Parameters:</h5>
  235. <table class="params table table-striped">
  236. <thead>
  237. <tr>
  238. <th>Name</th>
  239. <th>Type</th>
  240. <th class="last">Description</th>
  241. </tr>
  242. </thead>
  243. <tbody>
  244. <tr>
  245. <td class="name"><code>key</code></td>
  246. <td class="type">
  247. <span class="param-type">String</span>
  248. </td>
  249. <td class="description last"><p>The key to remove</p></td>
  250. </tr>
  251. </tbody>
  252. </table>
  253. <dl class="details">
  254. </dl>
  255. </dd>
  256. <hr>
  257. <dt>
  258. <h4 class="name" id="set"><span class="type-signature"></span>set(key, value)</h4>
  259. </dt>
  260. <dd>
  261. <div class="description">
  262. <p>Sets the given value for the given key, replacing any other values associated
  263. with that key. Normalizes the key.</p>
  264. </div>
  265. <h5>Parameters:</h5>
  266. <table class="params table table-striped">
  267. <thead>
  268. <tr>
  269. <th>Name</th>
  270. <th>Type</th>
  271. <th class="last">Description</th>
  272. </tr>
  273. </thead>
  274. <tbody>
  275. <tr>
  276. <td class="name"><code>key</code></td>
  277. <td class="type">
  278. <span class="param-type">String</span>
  279. </td>
  280. <td class="description last"><p>The key to set</p></td>
  281. </tr>
  282. <tr>
  283. <td class="name"><code>value</code></td>
  284. <td class="type">
  285. <span class="param-type">String</span>
  286. |
  287. <span class="param-type">Buffer</span>
  288. </td>
  289. <td class="description last"><p>The value to set. Must be a buffer if and only
  290. if the normalized key ends with '-bin'</p></td>
  291. </tr>
  292. </tbody>
  293. </table>
  294. <dl class="details">
  295. </dl>
  296. </dd>
  297. </dl>
  298. </article>
  299. </section>
  300. </div>
  301. </div>
  302. <div class="clearfix"></div>
  303. <div class="col-md-3">
  304. <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
  305. </div>
  306. </div>
  307. </div>
  308. <div class="modal fade" id="searchResults">
  309. <div class="modal-dialog">
  310. <div class="modal-content">
  311. <div class="modal-header">
  312. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  313. <h4 class="modal-title">Search results</h4>
  314. </div>
  315. <div class="modal-body"></div>
  316. <div class="modal-footer">
  317. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  318. </div>
  319. </div><!-- /.modal-content -->
  320. </div><!-- /.modal-dialog -->
  321. </div>
  322. <footer>
  323. <span class="jsdoc-message">
  324. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
  325. on 2018-01-16T12:05:13-05:00
  326. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
  327. </span>
  328. </footer>
  329. <script src="scripts/docstrap.lib.js"></script>
  330. <script src="scripts/toc.js"></script>
  331. <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
  332. <script>
  333. $( function () {
  334. $( "[id*='$']" ).each( function () {
  335. var $this = $( this );
  336. $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
  337. } );
  338. $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
  339. var $this = $( this );
  340. var example = $this.find( "code" );
  341. exampleText = example.html();
  342. var lang = /{@lang (.*?)}/.exec( exampleText );
  343. if ( lang && lang[1] ) {
  344. exampleText = exampleText.replace( lang[0], "" );
  345. example.html( exampleText );
  346. lang = lang[1];
  347. } else {
  348. var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
  349. lang = langClassMatch ? langClassMatch[1] : "javascript";
  350. }
  351. if ( lang ) {
  352. $this
  353. .addClass( "sunlight-highlight-" + lang )
  354. .addClass( "linenums" )
  355. .html( example.html() );
  356. }
  357. } );
  358. Sunlight.highlightAll( {
  359. lineNumbers : false,
  360. showMenu : true,
  361. enableDoclinks : true
  362. } );
  363. $.catchAnchorLinks( {
  364. navbarOffset: 10
  365. } );
  366. $( "#toc" ).toc( {
  367. anchorName : function ( i, heading, prefix ) {
  368. return $( heading ).attr( "id" ) || ( prefix + i );
  369. },
  370. selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
  371. showAndHide : false,
  372. smoothScrolling: true
  373. } );
  374. $( "#main span[id^='toc']" ).addClass( "toc-shim" );
  375. $( '.dropdown-toggle' ).dropdown();
  376. $( "table" ).each( function () {
  377. var $this = $( this );
  378. $this.addClass('table');
  379. } );
  380. } );
  381. </script>
  382. <!--Navigation and Symbol Display-->
  383. <!--Google Analytics-->
  384. <script type="text/javascript">
  385. $(document).ready(function() {
  386. SearcherDisplay.init();
  387. });
  388. </script>
  389. </body>
  390. </html>