| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=9"/>
- <meta name="generator" content="Doxygen 1.8.16"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>GRPC C++: Service Config in gRPC</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="dynsections.js"></script>
- <link href="search/search.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="search/searchdata.js"></script>
- <script type="text/javascript" src="search/search.js"></script>
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
- <div id="titlearea">
- <table cellspacing="0" cellpadding="0">
- <tbody>
- <tr style="height: 56px;">
- <td id="projectalign" style="padding-left: 0.5em;">
- <div id="projectname">GRPC C++
-  <span id="projectnumber">1.28.0</span>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.16 -->
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- /* @license-end */
- </script>
- <script type="text/javascript" src="menudata.js"></script>
- <script type="text/javascript" src="menu.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(function() {
- initMenu('',true,false,'search.php','Search');
- $(document).ready(function() { init_search(); });
- });
- /* @license-end */</script>
- <div id="main-nav"></div>
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- </div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <iframe src="javascript:void(0)" frameborder="0"
- name="MSearchResults" id="MSearchResults">
- </iframe>
- </div>
- </div><!-- top -->
- <div class="PageDoc"><div class="header">
- <div class="headertitle">
- <div class="title">Service Config in gRPC </div> </div>
- </div><!--header-->
- <div class="contents">
- <div class="textblock"><h1><a class="anchor" id="autotoc_md219"></a>
- Objective</h1>
- <p>The service config is a mechanism that allows service owners to publish parameters to be automatically used by all clients of their service.</p>
- <h1><a class="anchor" id="autotoc_md220"></a>
- Format</h1>
- <p>The service config is a JSON string of the following form:</p>
- <div class="fragment"><div class="line">{</div>
- <div class="line"> // [deprecated] Load balancing policy name (case insensitive).</div>
- <div class="line"> // Currently, the only selectable client-side policy provided with gRPC</div>
- <div class="line"> // is 'round_robin', but third parties may add their own policies.</div>
- <div class="line"> // This field is optional; if unset, the default behavior is to pick</div>
- <div class="line"> // the first available backend. If set, the load balancing policy should be</div>
- <div class="line"> // supported by the client, otherwise the service config is considered</div>
- <div class="line"> // invalid.</div>
- <div class="line"> // If the policy name is set via the client API, that value overrides</div>
- <div class="line"> // the value specified here.</div>
- <div class="line"> //</div>
- <div class="line"> // Note that if the resolver returns at least one balancer address (as</div>
- <div class="line"> // opposed to backend addresses), gRPC will use grpclb (see</div>
- <div class="line"> // https://github.com/grpc/grpc/blob/master/doc/load-balancing.md),</div>
- <div class="line"> // regardless of what LB policy is requested either here or via the</div>
- <div class="line"> // client API.</div>
- <div class="line"> 'loadBalancingPolicy': string,</div>
- <div class="line"> </div>
- <div class="line"> // Per-method configuration. Optional.</div>
- <div class="line"> 'methodConfig': [</div>
- <div class="line"> {</div>
- <div class="line"> // The names of the methods to which this method config applies. There</div>
- <div class="line"> // must be at least one name. Each name entry must be unique across the</div>
- <div class="line"> // entire service config. If the 'method' field is empty, then this</div>
- <div class="line"> // method config specifies the defaults for all methods for the specified</div>
- <div class="line"> // service.</div>
- <div class="line"> //</div>
- <div class="line"> // For example, let's say that the service config contains the following</div>
- <div class="line"> // method config entries:</div>
- <div class="line"> //</div>
- <div class="line"> // 'methodConfig': [</div>
- <div class="line"> // { 'name': [ { 'service': 'MyService' } ] ... },</div>
- <div class="line"> // { 'name': [ { 'service': 'MyService', 'method': 'Foo' } ] ... }</div>
- <div class="line"> // ]</div>
- <div class="line"> //</div>
- <div class="line"> // For a request for MyService/Foo, we will use the second entry, because</div>
- <div class="line"> // it exactly matches the service and method name.</div>
- <div class="line"> // For a request for MyService/Bar, we will use the first entry, because</div>
- <div class="line"> // it provides the default for all methods of MyService.</div>
- <div class="line"> 'name': [</div>
- <div class="line"> {</div>
- <div class="line"> // RPC service name. Required.</div>
- <div class="line"> // If using gRPC with protobuf as the IDL, then this will be of</div>
- <div class="line"> // the form "pkg.service_name", where "pkg" is the package name</div>
- <div class="line"> // defined in the proto file.</div>
- <div class="line"> 'service': string,</div>
- <div class="line"> </div>
- <div class="line"> // RPC method name. Optional (see above).</div>
- <div class="line"> 'method': string,</div>
- <div class="line"> }</div>
- <div class="line"> ],</div>
- <div class="line"> </div>
- <div class="line"> // Optional. Whether RPCs sent to this method should wait until the</div>
- <div class="line"> // connection is ready by default. If false, the RPC will abort</div>
- <div class="line"> // immediately if there is a transient failure connecting to the server.</div>
- <div class="line"> // Otherwise, gRPC will attempt to connect until the deadline is</div>
- <div class="line"> // exceeded.</div>
- <div class="line"> //</div>
- <div class="line"> // The value specified via the gRPC client API will override the value</div>
- <div class="line"> // set here. However, note that setting the value in the client API will</div>
- <div class="line"> // also affect transient errors encountered during name resolution,</div>
- <div class="line"> // which cannot be caught by the value here, since the service config</div>
- <div class="line"> // is obtained by the gRPC client via name resolution.</div>
- <div class="line"> 'waitForReady': bool,</div>
- <div class="line"> </div>
- <div class="line"> // Optional. The default timeout in seconds for RPCs sent to this method.</div>
- <div class="line"> // This can be overridden in code. If no reply is received in the</div>
- <div class="line"> // specified amount of time, the request is aborted and a</div>
- <div class="line"> // deadline-exceeded error status is returned to the caller.</div>
- <div class="line"> //</div>
- <div class="line"> // The actual deadline used will be the minimum of the value specified</div>
- <div class="line"> // here and the value set by the application via the gRPC client API.</div>
- <div class="line"> // If either one is not set, then the other will be used.</div>
- <div class="line"> // If neither is set, then the request has no deadline.</div>
- <div class="line"> //</div>
- <div class="line"> // The format of the value is that of the 'Duration' type defined here:</div>
- <div class="line"> // https://developers.google.com/protocol-buffers/docs/proto3#json</div>
- <div class="line"> 'timeout': string,</div>
- <div class="line"> </div>
- <div class="line"> // Optional. The maximum allowed payload size for an individual request</div>
- <div class="line"> // or object in a stream (client->server) in bytes. The size which is</div>
- <div class="line"> // measured is the serialized, uncompressed payload in bytes. This</div>
- <div class="line"> // applies both to streaming and non-streaming requests.</div>
- <div class="line"> //</div>
- <div class="line"> // The actual value used is the minimum of the value specified here and</div>
- <div class="line"> // the value set by the application via the gRPC client API.</div>
- <div class="line"> // If either one is not set, then the other will be used.</div>
- <div class="line"> // If neither is set, then the built-in default is used.</div>
- <div class="line"> //</div>
- <div class="line"> // If a client attempts to send an object larger than this value, it</div>
- <div class="line"> // will not be sent and the client will see an error.</div>
- <div class="line"> // Note that 0 is a valid value, meaning that the request message must</div>
- <div class="line"> // be empty.</div>
- <div class="line"> 'maxRequestMessageBytes': number,</div>
- <div class="line"> </div>
- <div class="line"> // Optional. The maximum allowed payload size for an individual response</div>
- <div class="line"> // or object in a stream (server->client) in bytes. The size which is</div>
- <div class="line"> // measured is the serialized, uncompressed payload in bytes. This</div>
- <div class="line"> // applies both to streaming and non-streaming requests.</div>
- <div class="line"> //</div>
- <div class="line"> // The actual value used is the minimum of the value specified here and</div>
- <div class="line"> // the value set by the application via the gRPC client API.</div>
- <div class="line"> // If either one is not set, then the other will be used.</div>
- <div class="line"> // If neither is set, then the built-in default is used.</div>
- <div class="line"> //</div>
- <div class="line"> // If a server attempts to send an object larger than this value, it</div>
- <div class="line"> // will not be sent, and the client will see an error.</div>
- <div class="line"> // Note that 0 is a valid value, meaning that the response message must</div>
- <div class="line"> // be empty.</div>
- <div class="line"> 'maxResponseMessageBytes': number</div>
- <div class="line"> }</div>
- <div class="line"> ]</div>
- <div class="line">}</div>
- </div><!-- fragment --><p>Note that new per-method parameters may be added in the future as new functionality is introduced.</p>
- <h1><a class="anchor" id="autotoc_md221"></a>
- Architecture</h1>
- <p>A service config is associated with a server name. The <a class="el" href="naming_8md.html">name resolver</a> plugin, when asked to resolve a particular server name, will return both the resolved addresses and the service config.</p>
- <p>TODO(roth): Design how the service config will be encoded in DNS.</p>
- <h1><a class="anchor" id="autotoc_md222"></a>
- APIs</h1>
- <p>The service config is used in the following APIs:</p>
- <ul>
- <li>In the resolver API, used by resolver plugins to return the service config to the gRPC client.</li>
- <li>In the gRPC client API, where users can query the channel to obtain the service config associated with the channel (for debugging purposes).</li>
- <li>In the gRPC client API, where users can set the service config explicitly. This is intended for use in unit tests. </li>
- </ul>
- </div></div><!-- contents -->
- </div><!-- PageDoc -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated on Tue Apr 7 2020 11:33:59 for GRPC C++ by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.16
- </small></address>
- </body>
- </html>
|