grpc.Metadata.html 18 KB

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