grpc.framework.foundation.html 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>grpc.framework.foundation package &mdash; grpcio 1.2.0 documentation</title>
  8. <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  9. <link rel="index" title="Index"
  10. href="genindex.html"/>
  11. <link rel="search" title="Search" href="search.html"/>
  12. <link rel="top" title="grpcio 1.2.0 documentation" href="index.html"/>
  13. <link rel="up" title="grpc.framework package" href="grpc.framework.html"/>
  14. <link rel="next" title="grpc.framework.interfaces package" href="grpc.framework.interfaces.html"/>
  15. <link rel="prev" title="grpc.framework.common package" href="grpc.framework.common.html"/>
  16. <script src="_static/js/modernizr.min.js"></script>
  17. </head>
  18. <body class="wy-body-for-nav" role="document">
  19. <div class="wy-grid-for-nav">
  20. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  21. <div class="wy-side-scroll">
  22. <div class="wy-side-nav-search">
  23. <a href="index.html" class="icon icon-home"> grpcio
  24. </a>
  25. <div class="version">
  26. 1.2.0
  27. </div>
  28. <div role="search">
  29. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  30. <input type="text" name="q" placeholder="Search docs" />
  31. <input type="hidden" name="check_keywords" value="yes" />
  32. <input type="hidden" name="area" value="default" />
  33. </form>
  34. </div>
  35. </div>
  36. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  37. <p class="caption"><span class="caption-text">Contents:</span></p>
  38. <ul class="current">
  39. <li class="toctree-l1 current"><a class="reference internal" href="grpc.html">grpc package</a><ul class="current">
  40. <li class="toctree-l2 current"><a class="reference internal" href="grpc.html#subpackages">Subpackages</a><ul class="current">
  41. <li class="toctree-l3"><a class="reference internal" href="grpc.beta.html">grpc.beta package</a></li>
  42. <li class="toctree-l3 current"><a class="reference internal" href="grpc.framework.html">grpc.framework package</a><ul class="current">
  43. <li class="toctree-l4 current"><a class="reference internal" href="grpc.framework.html#subpackages">Subpackages</a></li>
  44. <li class="toctree-l4"><a class="reference internal" href="grpc.framework.html#module-grpc.framework">Module contents</a></li>
  45. </ul>
  46. </li>
  47. </ul>
  48. </li>
  49. <li class="toctree-l2"><a class="reference internal" href="grpc.html#module-grpc">Module contents</a></li>
  50. </ul>
  51. </li>
  52. <li class="toctree-l1"><a class="reference internal" href="grpc.html#glossary">Glossary</a></li>
  53. </ul>
  54. </div>
  55. </div>
  56. </nav>
  57. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  58. <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
  59. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  60. <a href="index.html">grpcio</a>
  61. </nav>
  62. <div class="wy-nav-content">
  63. <div class="rst-content">
  64. <div role="navigation" aria-label="breadcrumbs navigation">
  65. <ul class="wy-breadcrumbs">
  66. <li><a href="index.html">Docs</a> &raquo;</li>
  67. <li><a href="grpc.html">grpc package</a> &raquo;</li>
  68. <li><a href="grpc.framework.html">grpc.framework package</a> &raquo;</li>
  69. <li>grpc.framework.foundation package</li>
  70. <li class="wy-breadcrumbs-aside">
  71. <a href="_sources/grpc.framework.foundation.rst.txt" rel="nofollow"> View page source</a>
  72. </li>
  73. </ul>
  74. <hr/>
  75. </div>
  76. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  77. <div itemprop="articleBody">
  78. <div class="section" id="grpc-framework-foundation-package">
  79. <h1>grpc.framework.foundation package<a class="headerlink" href="#grpc-framework-foundation-package" title="Permalink to this headline">¶</a></h1>
  80. <div class="section" id="submodules">
  81. <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
  82. </div>
  83. <div class="section" id="module-grpc.framework.foundation.abandonment">
  84. <span id="grpc-framework-foundation-abandonment-module"></span><h2>grpc.framework.foundation.abandonment module<a class="headerlink" href="#module-grpc.framework.foundation.abandonment" title="Permalink to this headline">¶</a></h2>
  85. <p>Utilities for indicating abandonment of computation.</p>
  86. <dl class="exception">
  87. <dt id="grpc.framework.foundation.abandonment.Abandoned">
  88. <em class="property">exception </em><code class="descclassname">grpc.framework.foundation.abandonment.</code><code class="descname">Abandoned</code><a class="reference internal" href="_modules/grpc/framework/foundation/abandonment.html#Abandoned"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.abandonment.Abandoned" title="Permalink to this definition">¶</a></dt>
  89. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p>
  90. <p>Indicates that some computation is being abandoned.</p>
  91. <p>Abandoning a computation is different than returning a value or raising
  92. an exception indicating some operational or programming defect.</p>
  93. </dd></dl>
  94. </div>
  95. <div class="section" id="module-grpc.framework.foundation.callable_util">
  96. <span id="grpc-framework-foundation-callable-util-module"></span><h2>grpc.framework.foundation.callable_util module<a class="headerlink" href="#module-grpc.framework.foundation.callable_util" title="Permalink to this headline">¶</a></h2>
  97. <p>Utilities for working with callables.</p>
  98. <dl class="class">
  99. <dt id="grpc.framework.foundation.callable_util.Outcome">
  100. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.callable_util.</code><code class="descname">Outcome</code><a class="reference internal" href="_modules/grpc/framework/foundation/callable_util.html#Outcome"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome" title="Permalink to this definition">¶</a></dt>
  101. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  102. <p>A sum type describing the outcome of some call.</p>
  103. <dl class="attribute">
  104. <dt id="grpc.framework.foundation.callable_util.Outcome.kind">
  105. <code class="descname">kind</code><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.kind" title="Permalink to this definition">¶</a></dt>
  106. <dd><p>One of Kind.RETURNED or Kind.RAISED respectively indicating that the
  107. call returned a value or raised an exception.</p>
  108. </dd></dl>
  109. <dl class="attribute">
  110. <dt id="grpc.framework.foundation.callable_util.Outcome.return_value">
  111. <code class="descname">return_value</code><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.return_value" title="Permalink to this definition">¶</a></dt>
  112. <dd><p>The value returned by the call. Must be present if kind is
  113. Kind.RETURNED.</p>
  114. </dd></dl>
  115. <dl class="attribute">
  116. <dt id="grpc.framework.foundation.callable_util.Outcome.exception">
  117. <code class="descname">exception</code><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.exception" title="Permalink to this definition">¶</a></dt>
  118. <dd><p>The exception raised by the call. Must be present if kind is
  119. Kind.RAISED.</p>
  120. </dd></dl>
  121. <dl class="class">
  122. <dt id="grpc.framework.foundation.callable_util.Outcome.Kind">
  123. <em class="property">class </em><code class="descname">Kind</code><a class="reference internal" href="_modules/grpc/framework/foundation/callable_util.html#Outcome.Kind"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.Kind" title="Permalink to this definition">¶</a></dt>
  124. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">enum.Enum</span></code></p>
  125. <p>Identifies the general kind of the outcome of some call.</p>
  126. <dl class="attribute">
  127. <dt id="grpc.framework.foundation.callable_util.Outcome.Kind.RAISED">
  128. <code class="descname">RAISED</code><em class="property"> = &lt;object object&gt;</em><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.Kind.RAISED" title="Permalink to this definition">¶</a></dt>
  129. <dd></dd></dl>
  130. <dl class="attribute">
  131. <dt id="grpc.framework.foundation.callable_util.Outcome.Kind.RETURNED">
  132. <code class="descname">RETURNED</code><em class="property"> = &lt;object object&gt;</em><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.Kind.RETURNED" title="Permalink to this definition">¶</a></dt>
  133. <dd></dd></dl>
  134. </dd></dl>
  135. </dd></dl>
  136. <dl class="function">
  137. <dt id="grpc.framework.foundation.callable_util.call_logging_exceptions">
  138. <code class="descclassname">grpc.framework.foundation.callable_util.</code><code class="descname">call_logging_exceptions</code><span class="sig-paren">(</span><em>behavior</em>, <em>message</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/callable_util.html#call_logging_exceptions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.callable_util.call_logging_exceptions" title="Permalink to this definition">¶</a></dt>
  139. <dd><p>Calls a behavior in a try-except that logs any exceptions it raises.</p>
  140. <table class="docutils field-list" frame="void" rules="none">
  141. <col class="field-name" />
  142. <col class="field-body" />
  143. <tbody valign="top">
  144. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  145. <li><strong>behavior</strong> &#8211; Any callable.</li>
  146. <li><strong>message</strong> &#8211; A string to log if the behavior raises an exception.</li>
  147. <li><strong>*args</strong> &#8211; Positional arguments to pass to the given behavior.</li>
  148. <li><strong>**kwargs</strong> &#8211; Keyword arguments to pass to the given behavior.</li>
  149. </ul>
  150. </td>
  151. </tr>
  152. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils">
  153. <dt>An Outcome describing whether the given behavior returned a value or raised</dt>
  154. <dd><p class="first last">an exception.</p>
  155. </dd>
  156. </dl>
  157. </p>
  158. </td>
  159. </tr>
  160. </tbody>
  161. </table>
  162. </dd></dl>
  163. <dl class="function">
  164. <dt id="grpc.framework.foundation.callable_util.with_exceptions_logged">
  165. <code class="descclassname">grpc.framework.foundation.callable_util.</code><code class="descname">with_exceptions_logged</code><span class="sig-paren">(</span><em>behavior</em>, <em>message</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/callable_util.html#with_exceptions_logged"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.callable_util.with_exceptions_logged" title="Permalink to this definition">¶</a></dt>
  166. <dd><p>Wraps a callable in a try-except that logs any exceptions it raises.</p>
  167. <table class="docutils field-list" frame="void" rules="none">
  168. <col class="field-name" />
  169. <col class="field-body" />
  170. <tbody valign="top">
  171. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  172. <li><strong>behavior</strong> &#8211; Any callable.</li>
  173. <li><strong>message</strong> &#8211; A string to log if the behavior raises an exception.</li>
  174. </ul>
  175. </td>
  176. </tr>
  177. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils">
  178. <dt>A callable that when executed invokes the given behavior. The returned</dt>
  179. <dd><p class="first last">callable takes the same arguments as the given behavior but returns a
  180. future.Outcome describing whether the given behavior returned a value or
  181. raised an exception.</p>
  182. </dd>
  183. </dl>
  184. </p>
  185. </td>
  186. </tr>
  187. </tbody>
  188. </table>
  189. </dd></dl>
  190. </div>
  191. <div class="section" id="module-grpc.framework.foundation.future">
  192. <span id="grpc-framework-foundation-future-module"></span><h2>grpc.framework.foundation.future module<a class="headerlink" href="#module-grpc.framework.foundation.future" title="Permalink to this headline">¶</a></h2>
  193. <p>A Future interface.</p>
  194. <p>Python doesn&#8217;t have a Future interface in its standard library. In the absence
  195. of such a standard, three separate, incompatible implementations
  196. (concurrent.futures.Future, ndb.Future, and asyncio.Future) have appeared. This
  197. interface attempts to be as compatible as possible with
  198. concurrent.futures.Future. From ndb.Future it adopts a traceback-object accessor
  199. method.</p>
  200. <p>Unlike the concrete and implemented Future classes listed above, the Future
  201. class defined in this module is an entirely abstract interface that anyone may
  202. implement and use.</p>
  203. <p>The one known incompatibility between this interface and the interface of
  204. concurrent.futures.Future is that this interface defines its own CancelledError
  205. and TimeoutError exceptions rather than raising the implementation-private
  206. concurrent.futures._base.CancelledError and the
  207. built-in-but-only-in-3.3-and-later TimeoutError.</p>
  208. <dl class="exception">
  209. <dt id="grpc.framework.foundation.future.CancelledError">
  210. <em class="property">exception </em><code class="descclassname">grpc.framework.foundation.future.</code><code class="descname">CancelledError</code><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#CancelledError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.CancelledError" title="Permalink to this definition">¶</a></dt>
  211. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p>
  212. <p>Indicates that the computation underlying a Future was cancelled.</p>
  213. </dd></dl>
  214. <dl class="class">
  215. <dt id="grpc.framework.foundation.future.Future">
  216. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.future.</code><code class="descname">Future</code><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future" title="Permalink to this definition">¶</a></dt>
  217. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  218. <p>A representation of a computation in another control flow.</p>
  219. <p>Computations represented by a Future may be yet to be begun, may be ongoing,
  220. or may have already completed.</p>
  221. <dl class="method">
  222. <dt id="grpc.framework.foundation.future.Future.add_done_callback">
  223. <code class="descname">add_done_callback</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.add_done_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.add_done_callback" title="Permalink to this definition">¶</a></dt>
  224. <dd><p>Adds a function to be called at completion of the computation.</p>
  225. <p>The callback will be passed this Future object describing the outcome of
  226. the computation.</p>
  227. <p>If the computation has already completed, the callback will be called
  228. immediately.</p>
  229. <table class="docutils field-list" frame="void" rules="none">
  230. <col class="field-name" />
  231. <col class="field-body" />
  232. <tbody valign="top">
  233. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fn</strong> &#8211; A callable taking this Future object as its single parameter.</td>
  234. </tr>
  235. </tbody>
  236. </table>
  237. </dd></dl>
  238. <dl class="method">
  239. <dt id="grpc.framework.foundation.future.Future.cancel">
  240. <code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.cancel" title="Permalink to this definition">¶</a></dt>
  241. <dd><p>Attempts to cancel the computation.</p>
  242. <p>This method does not block.</p>
  243. <table class="docutils field-list" frame="void" rules="none">
  244. <col class="field-name" />
  245. <col class="field-body" />
  246. <tbody valign="top">
  247. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  248. <dt>True if the computation has not yet begun, will not be allowed to take</dt>
  249. <dd>place, and determination of both was possible without blocking. False
  250. under all other circumstances including but not limited to the
  251. computation&#8217;s already having begun, the computation&#8217;s already having
  252. finished, and the computation&#8217;s having been scheduled for execution on a
  253. remote system for which a determination of whether or not it commenced
  254. before being cancelled cannot be made without blocking.</dd>
  255. </dl>
  256. </td>
  257. </tr>
  258. </tbody>
  259. </table>
  260. </dd></dl>
  261. <dl class="method">
  262. <dt id="grpc.framework.foundation.future.Future.cancelled">
  263. <code class="descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.cancelled"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.cancelled" title="Permalink to this definition">¶</a></dt>
  264. <dd><p>Describes whether the computation was cancelled.</p>
  265. <p>This method does not block.</p>
  266. <table class="docutils field-list" frame="void" rules="none">
  267. <col class="field-name" />
  268. <col class="field-body" />
  269. <tbody valign="top">
  270. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  271. <dt>True if the computation was cancelled any time before its result became</dt>
  272. <dd>immediately available. False under all other circumstances including but
  273. not limited to this object&#8217;s cancel method not having been called and
  274. the computation&#8217;s result having become immediately available.</dd>
  275. </dl>
  276. </td>
  277. </tr>
  278. </tbody>
  279. </table>
  280. </dd></dl>
  281. <dl class="method">
  282. <dt id="grpc.framework.foundation.future.Future.done">
  283. <code class="descname">done</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.done"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.done" title="Permalink to this definition">¶</a></dt>
  284. <dd><p>Describes whether the computation has taken place.</p>
  285. <p>This method does not block.</p>
  286. <table class="docutils field-list" frame="void" rules="none">
  287. <col class="field-name" />
  288. <col class="field-body" />
  289. <tbody valign="top">
  290. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  291. <dt>True if the computation is known to have either completed or have been</dt>
  292. <dd>unscheduled or interrupted. False if the computation may possibly be
  293. executing or scheduled to execute later.</dd>
  294. </dl>
  295. </td>
  296. </tr>
  297. </tbody>
  298. </table>
  299. </dd></dl>
  300. <dl class="method">
  301. <dt id="grpc.framework.foundation.future.Future.exception">
  302. <code class="descname">exception</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.exception"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.exception" title="Permalink to this definition">¶</a></dt>
  303. <dd><p>Return the exception raised by the computation.</p>
  304. <p>This method may return immediately or may block.</p>
  305. <table class="docutils field-list" frame="void" rules="none">
  306. <col class="field-name" />
  307. <col class="field-body" />
  308. <tbody valign="top">
  309. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> &#8211; The length of time in seconds to wait for the computation to
  310. terminate or be cancelled, or None if this method should block until
  311. the computation is terminated or is cancelled no matter how long that
  312. takes.</p>
  313. </td>
  314. </tr>
  315. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><dl class="docutils">
  316. <dt>The exception raised by the computation, or None if the computation did</dt>
  317. <dd><p class="first last">not raise an exception.</p>
  318. </dd>
  319. </dl>
  320. </p>
  321. </td>
  322. </tr>
  323. <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
  324. <li><a class="reference internal" href="#grpc.framework.foundation.future.TimeoutError" title="grpc.framework.foundation.future.TimeoutError"><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code></a> &#8211; If a timeout value is passed and the computation does not
  325. terminate within the allotted time.</li>
  326. <li><a class="reference internal" href="#grpc.framework.foundation.future.CancelledError" title="grpc.framework.foundation.future.CancelledError"><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code></a> &#8211; If the computation was cancelled.</li>
  327. </ul>
  328. </td>
  329. </tr>
  330. </tbody>
  331. </table>
  332. </dd></dl>
  333. <dl class="method">
  334. <dt id="grpc.framework.foundation.future.Future.result">
  335. <code class="descname">result</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.result"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.result" title="Permalink to this definition">¶</a></dt>
  336. <dd><p>Accesses the outcome of the computation or raises its exception.</p>
  337. <p>This method may return immediately or may block.</p>
  338. <table class="docutils field-list" frame="void" rules="none">
  339. <col class="field-name" />
  340. <col class="field-body" />
  341. <tbody valign="top">
  342. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> &#8211; The length of time in seconds to wait for the computation to
  343. finish or be cancelled, or None if this method should block until the
  344. computation has finished or is cancelled no matter how long that takes.</p>
  345. </td>
  346. </tr>
  347. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The return value of the computation.</p>
  348. </td>
  349. </tr>
  350. <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
  351. <li><a class="reference internal" href="#grpc.framework.foundation.future.TimeoutError" title="grpc.framework.foundation.future.TimeoutError"><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code></a> &#8211; If a timeout value is passed and the computation does not
  352. terminate within the allotted time.</li>
  353. <li><a class="reference internal" href="#grpc.framework.foundation.future.CancelledError" title="grpc.framework.foundation.future.CancelledError"><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code></a> &#8211; If the computation was cancelled.</li>
  354. <li><code class="xref py py-exc docutils literal"><span class="pre">Exception</span></code> &#8211; If the computation raised an exception, this call will raise
  355. the same exception.</li>
  356. </ul>
  357. </td>
  358. </tr>
  359. </tbody>
  360. </table>
  361. </dd></dl>
  362. <dl class="method">
  363. <dt id="grpc.framework.foundation.future.Future.running">
  364. <code class="descname">running</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.running"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.running" title="Permalink to this definition">¶</a></dt>
  365. <dd><p>Describes whether the computation is taking place.</p>
  366. <p>This method does not block.</p>
  367. <table class="docutils field-list" frame="void" rules="none">
  368. <col class="field-name" />
  369. <col class="field-body" />
  370. <tbody valign="top">
  371. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  372. <dt>True if the computation is scheduled to take place in the future or is</dt>
  373. <dd>taking place now, or False if the computation took place in the past or
  374. was cancelled.</dd>
  375. </dl>
  376. </td>
  377. </tr>
  378. </tbody>
  379. </table>
  380. </dd></dl>
  381. <dl class="method">
  382. <dt id="grpc.framework.foundation.future.Future.traceback">
  383. <code class="descname">traceback</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.traceback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.traceback" title="Permalink to this definition">¶</a></dt>
  384. <dd><p>Access the traceback of the exception raised by the computation.</p>
  385. <p>This method may return immediately or may block.</p>
  386. <table class="docutils field-list" frame="void" rules="none">
  387. <col class="field-name" />
  388. <col class="field-body" />
  389. <tbody valign="top">
  390. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> &#8211; The length of time in seconds to wait for the computation to
  391. terminate or be cancelled, or None if this method should block until
  392. the computation is terminated or is cancelled no matter how long that
  393. takes.</p>
  394. </td>
  395. </tr>
  396. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><dl class="docutils">
  397. <dt>The traceback of the exception raised by the computation, or None if the</dt>
  398. <dd><p class="first last">computation did not raise an exception.</p>
  399. </dd>
  400. </dl>
  401. </p>
  402. </td>
  403. </tr>
  404. <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
  405. <li><a class="reference internal" href="#grpc.framework.foundation.future.TimeoutError" title="grpc.framework.foundation.future.TimeoutError"><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code></a> &#8211; If a timeout value is passed and the computation does not
  406. terminate within the allotted time.</li>
  407. <li><a class="reference internal" href="#grpc.framework.foundation.future.CancelledError" title="grpc.framework.foundation.future.CancelledError"><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code></a> &#8211; If the computation was cancelled.</li>
  408. </ul>
  409. </td>
  410. </tr>
  411. </tbody>
  412. </table>
  413. </dd></dl>
  414. </dd></dl>
  415. <dl class="exception">
  416. <dt id="grpc.framework.foundation.future.TimeoutError">
  417. <em class="property">exception </em><code class="descclassname">grpc.framework.foundation.future.</code><code class="descname">TimeoutError</code><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#TimeoutError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.TimeoutError" title="Permalink to this definition">¶</a></dt>
  418. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p>
  419. <p>Indicates that a particular call timed out.</p>
  420. </dd></dl>
  421. </div>
  422. <div class="section" id="module-grpc.framework.foundation.logging_pool">
  423. <span id="grpc-framework-foundation-logging-pool-module"></span><h2>grpc.framework.foundation.logging_pool module<a class="headerlink" href="#module-grpc.framework.foundation.logging_pool" title="Permalink to this headline">¶</a></h2>
  424. <p>A thread pool that logs exceptions raised by tasks executed within it.</p>
  425. <dl class="function">
  426. <dt id="grpc.framework.foundation.logging_pool.pool">
  427. <code class="descclassname">grpc.framework.foundation.logging_pool.</code><code class="descname">pool</code><span class="sig-paren">(</span><em>max_workers</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/logging_pool.html#pool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.logging_pool.pool" title="Permalink to this definition">¶</a></dt>
  428. <dd><p>Creates a thread pool that logs exceptions raised by the tasks within it.</p>
  429. <table class="docutils field-list" frame="void" rules="none">
  430. <col class="field-name" />
  431. <col class="field-body" />
  432. <tbody valign="top">
  433. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>max_workers</strong> &#8211; The maximum number of worker threads to allow the pool.</td>
  434. </tr>
  435. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  436. <dt>A futures.ThreadPoolExecutor-compatible thread pool that logs exceptions</dt>
  437. <dd>raised by the tasks executed within it.</dd>
  438. </dl>
  439. </td>
  440. </tr>
  441. </tbody>
  442. </table>
  443. </dd></dl>
  444. </div>
  445. <div class="section" id="module-grpc.framework.foundation.stream">
  446. <span id="grpc-framework-foundation-stream-module"></span><h2>grpc.framework.foundation.stream module<a class="headerlink" href="#module-grpc.framework.foundation.stream" title="Permalink to this headline">¶</a></h2>
  447. <p>Interfaces related to streams of values or objects.</p>
  448. <dl class="class">
  449. <dt id="grpc.framework.foundation.stream.Consumer">
  450. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream.</code><code class="descname">Consumer</code><a class="reference internal" href="_modules/grpc/framework/foundation/stream.html#Consumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream.Consumer" title="Permalink to this definition">¶</a></dt>
  451. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  452. <p>Interface for consumers of finite streams of values or objects.</p>
  453. <dl class="method">
  454. <dt id="grpc.framework.foundation.stream.Consumer.consume">
  455. <code class="descname">consume</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream.html#Consumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream.Consumer.consume" title="Permalink to this definition">¶</a></dt>
  456. <dd><p>Accepts a value.</p>
  457. <table class="docutils field-list" frame="void" rules="none">
  458. <col class="field-name" />
  459. <col class="field-body" />
  460. <tbody valign="top">
  461. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> &#8211; Any value accepted by this Consumer.</td>
  462. </tr>
  463. </tbody>
  464. </table>
  465. </dd></dl>
  466. <dl class="method">
  467. <dt id="grpc.framework.foundation.stream.Consumer.consume_and_terminate">
  468. <code class="descname">consume_and_terminate</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream.html#Consumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream.Consumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt>
  469. <dd><p>Supplies a value and signals that no more values will be supplied.</p>
  470. <table class="docutils field-list" frame="void" rules="none">
  471. <col class="field-name" />
  472. <col class="field-body" />
  473. <tbody valign="top">
  474. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> &#8211; Any value accepted by this Consumer.</td>
  475. </tr>
  476. </tbody>
  477. </table>
  478. </dd></dl>
  479. <dl class="method">
  480. <dt id="grpc.framework.foundation.stream.Consumer.terminate">
  481. <code class="descname">terminate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream.html#Consumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream.Consumer.terminate" title="Permalink to this definition">¶</a></dt>
  482. <dd><p>Indicates to this Consumer that no more values will be supplied.</p>
  483. </dd></dl>
  484. </dd></dl>
  485. </div>
  486. <div class="section" id="module-grpc.framework.foundation.stream_util">
  487. <span id="grpc-framework-foundation-stream-util-module"></span><h2>grpc.framework.foundation.stream_util module<a class="headerlink" href="#module-grpc.framework.foundation.stream_util" title="Permalink to this headline">¶</a></h2>
  488. <p>Helpful utilities related to the stream module.</p>
  489. <dl class="class">
  490. <dt id="grpc.framework.foundation.stream_util.IterableConsumer">
  491. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream_util.</code><code class="descname">IterableConsumer</code><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer" title="Permalink to this definition">¶</a></dt>
  492. <dd><p>Bases: <a class="reference internal" href="#grpc.framework.foundation.stream.Consumer" title="grpc.framework.foundation.stream.Consumer"><code class="xref py py-class docutils literal"><span class="pre">grpc.framework.foundation.stream.Consumer</span></code></a></p>
  493. <p>A Consumer that when iterated over emits the values it has consumed.</p>
  494. <dl class="method">
  495. <dt id="grpc.framework.foundation.stream_util.IterableConsumer.consume">
  496. <code class="descname">consume</code><span class="sig-paren">(</span><em>stock_reply</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer.consume" title="Permalink to this definition">¶</a></dt>
  497. <dd></dd></dl>
  498. <dl class="method">
  499. <dt id="grpc.framework.foundation.stream_util.IterableConsumer.consume_and_terminate">
  500. <code class="descname">consume_and_terminate</code><span class="sig-paren">(</span><em>stock_reply</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt>
  501. <dd></dd></dl>
  502. <dl class="method">
  503. <dt id="grpc.framework.foundation.stream_util.IterableConsumer.next">
  504. <code class="descname">next</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer.next"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer.next" title="Permalink to this definition">¶</a></dt>
  505. <dd></dd></dl>
  506. <dl class="method">
  507. <dt id="grpc.framework.foundation.stream_util.IterableConsumer.terminate">
  508. <code class="descname">terminate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer.terminate" title="Permalink to this definition">¶</a></dt>
  509. <dd></dd></dl>
  510. </dd></dl>
  511. <dl class="class">
  512. <dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer">
  513. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream_util.</code><code class="descname">ThreadSwitchingConsumer</code><span class="sig-paren">(</span><em>sink</em>, <em>pool</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#ThreadSwitchingConsumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.ThreadSwitchingConsumer" title="Permalink to this definition">¶</a></dt>
  514. <dd><p>Bases: <a class="reference internal" href="#grpc.framework.foundation.stream.Consumer" title="grpc.framework.foundation.stream.Consumer"><code class="xref py py-class docutils literal"><span class="pre">grpc.framework.foundation.stream.Consumer</span></code></a></p>
  515. <p>A Consumer decorator that affords serialization and asynchrony.</p>
  516. <dl class="method">
  517. <dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume">
  518. <code class="descname">consume</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#ThreadSwitchingConsumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume" title="Permalink to this definition">¶</a></dt>
  519. <dd></dd></dl>
  520. <dl class="method">
  521. <dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume_and_terminate">
  522. <code class="descname">consume_and_terminate</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#ThreadSwitchingConsumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt>
  523. <dd></dd></dl>
  524. <dl class="method">
  525. <dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.terminate">
  526. <code class="descname">terminate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#ThreadSwitchingConsumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.terminate" title="Permalink to this definition">¶</a></dt>
  527. <dd></dd></dl>
  528. </dd></dl>
  529. <dl class="class">
  530. <dt id="grpc.framework.foundation.stream_util.TransformingConsumer">
  531. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream_util.</code><code class="descname">TransformingConsumer</code><span class="sig-paren">(</span><em>transformation</em>, <em>downstream</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#TransformingConsumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.TransformingConsumer" title="Permalink to this definition">¶</a></dt>
  532. <dd><p>Bases: <a class="reference internal" href="#grpc.framework.foundation.stream.Consumer" title="grpc.framework.foundation.stream.Consumer"><code class="xref py py-class docutils literal"><span class="pre">grpc.framework.foundation.stream.Consumer</span></code></a></p>
  533. <p>A stream.Consumer that passes a transformation of its input to another.</p>
  534. <dl class="method">
  535. <dt id="grpc.framework.foundation.stream_util.TransformingConsumer.consume">
  536. <code class="descname">consume</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#TransformingConsumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.TransformingConsumer.consume" title="Permalink to this definition">¶</a></dt>
  537. <dd></dd></dl>
  538. <dl class="method">
  539. <dt id="grpc.framework.foundation.stream_util.TransformingConsumer.consume_and_terminate">
  540. <code class="descname">consume_and_terminate</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#TransformingConsumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.TransformingConsumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt>
  541. <dd></dd></dl>
  542. <dl class="method">
  543. <dt id="grpc.framework.foundation.stream_util.TransformingConsumer.terminate">
  544. <code class="descname">terminate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#TransformingConsumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.TransformingConsumer.terminate" title="Permalink to this definition">¶</a></dt>
  545. <dd></dd></dl>
  546. </dd></dl>
  547. </div>
  548. <div class="section" id="module-grpc.framework.foundation">
  549. <span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-grpc.framework.foundation" title="Permalink to this headline">¶</a></h2>
  550. </div>
  551. </div>
  552. </div>
  553. <div class="articleComments">
  554. </div>
  555. </div>
  556. <footer>
  557. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  558. <a href="grpc.framework.interfaces.html" class="btn btn-neutral float-right" title="grpc.framework.interfaces package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
  559. <a href="grpc.framework.common.html" class="btn btn-neutral" title="grpc.framework.common package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
  560. </div>
  561. <hr/>
  562. <div role="contentinfo">
  563. <p>
  564. &copy; Copyright 2016, The gRPC Authors.
  565. </p>
  566. </div>
  567. Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
  568. </footer>
  569. </div>
  570. </div>
  571. </section>
  572. </div>
  573. <script type="text/javascript">
  574. var DOCUMENTATION_OPTIONS = {
  575. URL_ROOT:'./',
  576. VERSION:'1.2.0',
  577. COLLAPSE_INDEX:false,
  578. FILE_SUFFIX:'.html',
  579. HAS_SOURCE: true,
  580. SOURCELINK_SUFFIX: '.txt'
  581. };
  582. </script>
  583. <script type="text/javascript" src="_static/jquery.js"></script>
  584. <script type="text/javascript" src="_static/underscore.js"></script>
  585. <script type="text/javascript" src="_static/doctools.js"></script>
  586. <script type="text/javascript" src="_static/js/theme.js"></script>
  587. <script type="text/javascript">
  588. jQuery(function () {
  589. SphinxRtdTheme.StickyNav.enable();
  590. });
  591. </script>
  592. </body>
  593. </html>