| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.13"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>GRPC Core: 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 Core
-  <span id="projectnumber">6.0.0</span>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.13 -->
- <script type="text/javascript">
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- </script>
- <script type="text/javascript" src="menudata.js"></script>
- <script type="text/javascript" src="menu.js"></script>
- <script type="text/javascript">
- $(function() {
- initMenu('',true,false,'search.php','Search');
- $(document).ready(function() { init_search(); });
- });
- </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="header">
- <div class="headertitle">
- <div class="title">Service Config in gRPC </div> </div>
- </div><!--header-->
- <div class="contents">
- <div class="textblock"><h1>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>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"> // 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.</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"> // Whether RPCs sent to this method should wait until the connection is</div><div class="line"> // ready by default. If false, the RPC will abort immediately if there</div><div class="line"> // is a transient failure connecting to the server. Otherwise, gRPC will</div><div class="line"> // attempt to connect until the deadline is 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"> // The default timeout in seconds for RPCs sent to this method. This can</div><div class="line"> // be overridden in code. If no reply is received in the specified amount</div><div class="line"> // of time, the request is aborted and a deadline-exceeded error status</div><div class="line"> // 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"> // The maximum allowed payload size for an individual request or object</div><div class="line"> // in a stream (client->server) in bytes. The size which is measured is</div><div class="line"> // the serialized, uncompressed payload in bytes. This applies both</div><div class="line"> // 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"> // The maximum allowed payload size for an individual response or object</div><div class="line"> // in a stream (server->client) in bytes. The size which is measured is</div><div class="line"> // the serialized, uncompressed payload in bytes. This applies both</div><div class="line"> // 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>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>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 -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated on Fri Apr 13 2018 15:03:52 for GRPC Core by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.13
- </small></address>
- </body>
- </html>
|