grpc.framework.foundation.html 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  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 0.10.0a0 documentation</title>
  8. <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  9. <link rel="top" title="grpcio 0.10.0a0 documentation" href="index.html"/>
  10. <link rel="up" title="grpc.framework package" href="grpc.framework.html"/>
  11. <link rel="next" title="grpc.framework.interfaces package" href="grpc.framework.interfaces.html"/>
  12. <link rel="prev" title="grpc.framework.face.testing package" href="grpc.framework.face.testing.html"/>
  13. <script src="_static/js/modernizr.min.js"></script>
  14. </head>
  15. <body class="wy-body-for-nav" role="document">
  16. <div class="wy-grid-for-nav">
  17. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  18. <div class="wy-side-nav-search">
  19. <a href="index.html" class="icon icon-home"> grpcio
  20. </a>
  21. <div role="search">
  22. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  23. <input type="text" name="q" placeholder="Search docs" />
  24. <input type="hidden" name="check_keywords" value="yes" />
  25. <input type="hidden" name="area" value="default" />
  26. </form>
  27. </div>
  28. </div>
  29. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  30. <ul class="current">
  31. <li class="toctree-l1 current"><a class="reference internal" href="grpc.html">grpc package</a><ul class="current">
  32. <li class="toctree-l2 current"><a class="reference internal" href="grpc.html#subpackages">Subpackages</a><ul class="current">
  33. <li class="toctree-l3"><a class="reference internal" href="grpc.early_adopter.html">grpc.early_adopter package</a><ul>
  34. <li class="toctree-l4"><a class="reference internal" href="grpc.early_adopter.html#submodules">Submodules</a></li>
  35. <li class="toctree-l4"><a class="reference internal" href="grpc.early_adopter.html#module-grpc.early_adopter.implementations">grpc.early_adopter.implementations module</a></li>
  36. <li class="toctree-l4"><a class="reference internal" href="grpc.early_adopter.html#module-grpc.early_adopter.implementations_test">grpc.early_adopter.implementations_test module</a></li>
  37. <li class="toctree-l4"><a class="reference internal" href="grpc.early_adopter.html#module-grpc.early_adopter">Module contents</a></li>
  38. </ul>
  39. </li>
  40. <li class="toctree-l3 current"><a class="reference internal" href="grpc.framework.html">grpc.framework package</a><ul class="current">
  41. <li class="toctree-l4 current"><a class="reference internal" href="grpc.framework.html#subpackages">Subpackages</a></li>
  42. <li class="toctree-l4"><a class="reference internal" href="grpc.framework.html#module-grpc.framework">Module contents</a></li>
  43. </ul>
  44. </li>
  45. </ul>
  46. </li>
  47. <li class="toctree-l2"><a class="reference internal" href="grpc.html#module-grpc">Module contents</a></li>
  48. </ul>
  49. </li>
  50. </ul>
  51. </div>
  52. &nbsp;
  53. </nav>
  54. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  55. <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
  56. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  57. <a href="index.html">grpcio</a>
  58. </nav>
  59. <div class="wy-nav-content">
  60. <div class="rst-content">
  61. <div role="navigation" aria-label="breadcrumbs navigation">
  62. <ul class="wy-breadcrumbs">
  63. <li><a href="index.html">Docs</a> &raquo;</li>
  64. <li><a href="grpc.html">grpc package</a> &raquo;</li>
  65. <li><a href="grpc.framework.html">grpc.framework package</a> &raquo;</li>
  66. <li>grpc.framework.foundation package</li>
  67. <li class="wy-breadcrumbs-aside">
  68. <a href="_sources/grpc.framework.foundation.txt" rel="nofollow"> View page source</a>
  69. </li>
  70. </ul>
  71. <hr/>
  72. </div>
  73. <div role="main" class="document">
  74. <div class="section" id="grpc-framework-foundation-package">
  75. <h1>grpc.framework.foundation package<a class="headerlink" href="#grpc-framework-foundation-package" title="Permalink to this headline">¶</a></h1>
  76. <div class="section" id="submodules">
  77. <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
  78. </div>
  79. <div class="section" id="module-grpc.framework.foundation.abandonment">
  80. <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>
  81. <p>Utilities for indicating abandonment of computation.</p>
  82. <dl class="exception">
  83. <dt id="grpc.framework.foundation.abandonment.Abandoned">
  84. <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>
  85. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p>
  86. <p>Indicates that some computation is being abandoned.</p>
  87. <p>Abandoning a computation is different than returning a value or raising
  88. an exception indicating some operational or programming defect.</p>
  89. </dd></dl>
  90. </div>
  91. <div class="section" id="module-grpc.framework.foundation.activated">
  92. <span id="grpc-framework-foundation-activated-module"></span><h2>grpc.framework.foundation.activated module<a class="headerlink" href="#module-grpc.framework.foundation.activated" title="Permalink to this headline">¶</a></h2>
  93. <p>Interfaces related to streams of values or objects.</p>
  94. <dl class="class">
  95. <dt id="grpc.framework.foundation.activated.Activated">
  96. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.activated.</code><code class="descname">Activated</code><a class="reference internal" href="_modules/grpc/framework/foundation/activated.html#Activated"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.activated.Activated" title="Permalink to this definition">¶</a></dt>
  97. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  98. <p>Interface for objects that may be started and stopped.</p>
  99. <p>Values implementing this type must also implement the context manager
  100. protocol.</p>
  101. <dl class="method">
  102. <dt id="grpc.framework.foundation.activated.Activated.__enter__">
  103. <code class="descname">__enter__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/activated.html#Activated.__enter__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.activated.Activated.__enter__" title="Permalink to this definition">¶</a></dt>
  104. <dd><p>See the context manager protocol for specification.</p>
  105. </dd></dl>
  106. <dl class="method">
  107. <dt id="grpc.framework.foundation.activated.Activated.__exit__">
  108. <code class="descname">__exit__</code><span class="sig-paren">(</span><em>exc_type</em>, <em>exc_val</em>, <em>exc_tb</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/activated.html#Activated.__exit__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.activated.Activated.__exit__" title="Permalink to this definition">¶</a></dt>
  109. <dd><p>See the context manager protocol for specification.</p>
  110. </dd></dl>
  111. <dl class="method">
  112. <dt id="grpc.framework.foundation.activated.Activated.start">
  113. <code class="descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/activated.html#Activated.start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.activated.Activated.start" title="Permalink to this definition">¶</a></dt>
  114. <dd><p>Activates this object.</p>
  115. <table class="docutils field-list" frame="void" rules="none">
  116. <col class="field-name" />
  117. <col class="field-body" />
  118. <tbody valign="top">
  119. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A value equal to the value returned by this object&#8217;s __enter__ method.</td>
  120. </tr>
  121. </tbody>
  122. </table>
  123. </dd></dl>
  124. <dl class="method">
  125. <dt id="grpc.framework.foundation.activated.Activated.stop">
  126. <code class="descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/activated.html#Activated.stop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.activated.Activated.stop" title="Permalink to this definition">¶</a></dt>
  127. <dd><p>Deactivates this object.</p>
  128. </dd></dl>
  129. </dd></dl>
  130. </div>
  131. <div class="section" id="module-grpc.framework.foundation.callable_util">
  132. <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>
  133. <p>Utilities for working with callables.</p>
  134. <dl class="class">
  135. <dt id="grpc.framework.foundation.callable_util.Outcome">
  136. <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>
  137. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  138. <p>A sum type describing the outcome of some call.</p>
  139. <dl class="attribute">
  140. <dt id="grpc.framework.foundation.callable_util.Outcome.kind">
  141. <code class="descname">kind</code><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.kind" title="Permalink to this definition">¶</a></dt>
  142. <dd><p>One of Kind.RETURNED or Kind.RAISED respectively indicating that the
  143. call returned a value or raised an exception.</p>
  144. </dd></dl>
  145. <dl class="attribute">
  146. <dt id="grpc.framework.foundation.callable_util.Outcome.return_value">
  147. <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>
  148. <dd><p>The value returned by the call. Must be present if kind is
  149. Kind.RETURNED.</p>
  150. </dd></dl>
  151. <dl class="attribute">
  152. <dt id="grpc.framework.foundation.callable_util.Outcome.exception">
  153. <code class="descname">exception</code><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.exception" title="Permalink to this definition">¶</a></dt>
  154. <dd><p>The exception raised by the call. Must be present if kind is
  155. Kind.RAISED.</p>
  156. </dd></dl>
  157. <dl class="class">
  158. <dt id="grpc.framework.foundation.callable_util.Outcome.Kind">
  159. <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>
  160. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">enum.Enum</span></code></p>
  161. <p>Identifies the general kind of the outcome of some call.</p>
  162. </dd></dl>
  163. </dd></dl>
  164. <dl class="function">
  165. <dt id="grpc.framework.foundation.callable_util.call_logging_exceptions">
  166. <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>
  167. <dd><p>Calls a behavior in a try-except that logs any exceptions it raises.</p>
  168. <table class="docutils field-list" frame="void" rules="none">
  169. <col class="field-name" />
  170. <col class="field-body" />
  171. <tbody valign="top">
  172. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  173. <li><strong>behavior</strong> &#8211; Any callable.</li>
  174. <li><strong>message</strong> &#8211; A string to log if the behavior raises an exception.</li>
  175. <li><strong>*args</strong> &#8211; Positional arguments to pass to the given behavior.</li>
  176. <li><strong>**kwargs</strong> &#8211; Keyword arguments to pass to the given behavior.</li>
  177. </ul>
  178. </td>
  179. </tr>
  180. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An Outcome describing whether the given behavior returned a value or raised
  181. an exception.</p>
  182. </td>
  183. </tr>
  184. </tbody>
  185. </table>
  186. </dd></dl>
  187. <dl class="function">
  188. <dt id="grpc.framework.foundation.callable_util.with_exceptions_logged">
  189. <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>
  190. <dd><p>Wraps a callable in a try-except that logs any exceptions it raises.</p>
  191. <table class="docutils field-list" frame="void" rules="none">
  192. <col class="field-name" />
  193. <col class="field-body" />
  194. <tbody valign="top">
  195. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  196. <li><strong>behavior</strong> &#8211; Any callable.</li>
  197. <li><strong>message</strong> &#8211; A string to log if the behavior raises an exception.</li>
  198. </ul>
  199. </td>
  200. </tr>
  201. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A callable that when executed invokes the given behavior. The returned
  202. callable takes the same arguments as the given behavior but returns a
  203. future.Outcome describing whether the given behavior returned a value or
  204. raised an exception.</p>
  205. </td>
  206. </tr>
  207. </tbody>
  208. </table>
  209. </dd></dl>
  210. </div>
  211. <div class="section" id="module-grpc.framework.foundation.future">
  212. <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>
  213. <p>A Future interface.</p>
  214. <p>Python doesn&#8217;t have a Future interface in its standard library. In the absence
  215. of such a standard, three separate, incompatible implementations
  216. (concurrent.futures.Future, ndb.Future, and asyncio.Future) have appeared. This
  217. interface attempts to be as compatible as possible with
  218. concurrent.futures.Future. From ndb.Future it adopts a traceback-object accessor
  219. method.</p>
  220. <p>Unlike the concrete and implemented Future classes listed above, the Future
  221. class defined in this module is an entirely abstract interface that anyone may
  222. implement and use.</p>
  223. <p>The one known incompatibility between this interface and the interface of
  224. concurrent.futures.Future is that this interface defines its own CancelledError
  225. and TimeoutError exceptions rather than raising the implementation-private
  226. concurrent.futures._base.CancelledError and the
  227. built-in-but-only-in-3.3-and-later TimeoutError.</p>
  228. <dl class="exception">
  229. <dt id="grpc.framework.foundation.future.CancelledError">
  230. <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>
  231. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p>
  232. <p>Indicates that the computation underlying a Future was cancelled.</p>
  233. </dd></dl>
  234. <dl class="class">
  235. <dt id="grpc.framework.foundation.future.Future">
  236. <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>
  237. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  238. <p>A representation of a computation in another control flow.</p>
  239. <p>Computations represented by a Future may be yet to be begun, may be ongoing,
  240. or may have already completed.</p>
  241. <dl class="method">
  242. <dt id="grpc.framework.foundation.future.Future.add_done_callback">
  243. <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>
  244. <dd><p>Adds a function to be called at completion of the computation.</p>
  245. <p>The callback will be passed this Future object describing the outcome of
  246. the computation.</p>
  247. <p>If the computation has already completed, the callback will be called
  248. immediately.</p>
  249. <table class="docutils field-list" frame="void" rules="none">
  250. <col class="field-name" />
  251. <col class="field-body" />
  252. <tbody valign="top">
  253. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fn</strong> &#8211; A callable taking a this Future object as its single parameter.</td>
  254. </tr>
  255. </tbody>
  256. </table>
  257. </dd></dl>
  258. <dl class="method">
  259. <dt id="grpc.framework.foundation.future.Future.cancel">
  260. <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>
  261. <dd><p>Attempts to cancel the computation.</p>
  262. <p>This method does not block.</p>
  263. <table class="docutils field-list" frame="void" rules="none">
  264. <col class="field-name" />
  265. <col class="field-body" />
  266. <tbody valign="top">
  267. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if the computation has not yet begun, will not be allowed to take
  268. place, and determination of both was possible without blocking. False
  269. under all other circumstances including but not limited to the
  270. computation&#8217;s already having begun, the computation&#8217;s already having
  271. finished, and the computation&#8217;s having been scheduled for execution on a
  272. remote system for which a determination of whether or not it commenced
  273. before being cancelled cannot be made without blocking.</td>
  274. </tr>
  275. </tbody>
  276. </table>
  277. </dd></dl>
  278. <dl class="method">
  279. <dt id="grpc.framework.foundation.future.Future.cancelled">
  280. <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>
  281. <dd><p>Describes whether the computation was cancelled.</p>
  282. <p>This method does not block.</p>
  283. <table class="docutils field-list" frame="void" rules="none">
  284. <col class="field-name" />
  285. <col class="field-body" />
  286. <tbody valign="top">
  287. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if the computation was cancelled any time before its result became
  288. immediately available. False under all other circumstances including but
  289. not limited to this object&#8217;s cancel method not having been called and
  290. the computation&#8217;s result having become immediately available.</td>
  291. </tr>
  292. </tbody>
  293. </table>
  294. </dd></dl>
  295. <dl class="method">
  296. <dt id="grpc.framework.foundation.future.Future.done">
  297. <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>
  298. <dd><p>Describes whether the computation has taken place.</p>
  299. <p>This method does not block.</p>
  300. <table class="docutils field-list" frame="void" rules="none">
  301. <col class="field-name" />
  302. <col class="field-body" />
  303. <tbody valign="top">
  304. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if the computation is known to have either completed or have been
  305. unscheduled or interrupted. False if the computation may possibly be
  306. executing or scheduled to execute later.</td>
  307. </tr>
  308. </tbody>
  309. </table>
  310. </dd></dl>
  311. <dl class="method">
  312. <dt id="grpc.framework.foundation.future.Future.exception">
  313. <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>
  314. <dd><p>Return the exception raised by the computation.</p>
  315. <p>This method may return immediately or may block.</p>
  316. <table class="docutils field-list" frame="void" rules="none">
  317. <col class="field-name" />
  318. <col class="field-body" />
  319. <tbody valign="top">
  320. <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
  321. terminate or be cancelled, or None if this method should block until
  322. the computation is terminated or is cancelled no matter how long that
  323. takes.</p>
  324. </td>
  325. </tr>
  326. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The exception raised by the computation, or None if the computation did
  327. not raise an exception.</p>
  328. </td>
  329. </tr>
  330. <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
  331. <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;
  332. If a timeout value is passed and the computation does not
  333. terminate within the allotted time.</li>
  334. <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;
  335. If the computation was cancelled.</li>
  336. </ul>
  337. </td>
  338. </tr>
  339. </tbody>
  340. </table>
  341. </dd></dl>
  342. <dl class="method">
  343. <dt id="grpc.framework.foundation.future.Future.result">
  344. <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>
  345. <dd><p>Accesses the outcome of the computation or raises its exception.</p>
  346. <p>This method may return immediately or may block.</p>
  347. <table class="docutils field-list" frame="void" rules="none">
  348. <col class="field-name" />
  349. <col class="field-body" />
  350. <tbody valign="top">
  351. <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
  352. finish or be cancelled, or None if this method should block until the
  353. computation has finished or is cancelled no matter how long that takes.</p>
  354. </td>
  355. </tr>
  356. <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>
  357. </td>
  358. </tr>
  359. <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
  360. <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;
  361. If a timeout value is passed and the computation does not
  362. terminate within the allotted time.</li>
  363. <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;
  364. If the computation was cancelled.</li>
  365. <li><code class="xref py py-exc docutils literal"><span class="pre">Exception</span></code> &#8211;
  366. If the computation raised an exception, this call will raise
  367. the same exception.</li>
  368. </ul>
  369. </td>
  370. </tr>
  371. </tbody>
  372. </table>
  373. </dd></dl>
  374. <dl class="method">
  375. <dt id="grpc.framework.foundation.future.Future.running">
  376. <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>
  377. <dd><p>Describes whether the computation is taking place.</p>
  378. <p>This method does not block.</p>
  379. <table class="docutils field-list" frame="void" rules="none">
  380. <col class="field-name" />
  381. <col class="field-body" />
  382. <tbody valign="top">
  383. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if the computation is scheduled to take place in the future or is
  384. taking place now, or False if the computation took place in the past or
  385. was cancelled.</td>
  386. </tr>
  387. </tbody>
  388. </table>
  389. </dd></dl>
  390. <dl class="method">
  391. <dt id="grpc.framework.foundation.future.Future.traceback">
  392. <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>
  393. <dd><p>Access the traceback of the exception raised by the computation.</p>
  394. <p>This method may return immediately or may block.</p>
  395. <table class="docutils field-list" frame="void" rules="none">
  396. <col class="field-name" />
  397. <col class="field-body" />
  398. <tbody valign="top">
  399. <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
  400. terminate or be cancelled, or None if this method should block until
  401. the computation is terminated or is cancelled no matter how long that
  402. takes.</p>
  403. </td>
  404. </tr>
  405. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The traceback of the exception raised by the computation, or None if the
  406. computation did not raise an exception.</p>
  407. </td>
  408. </tr>
  409. <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
  410. <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;
  411. If a timeout value is passed and the computation does not
  412. terminate within the allotted time.</li>
  413. <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;
  414. If the computation was cancelled.</li>
  415. </ul>
  416. </td>
  417. </tr>
  418. </tbody>
  419. </table>
  420. </dd></dl>
  421. </dd></dl>
  422. <dl class="exception">
  423. <dt id="grpc.framework.foundation.future.TimeoutError">
  424. <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>
  425. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p>
  426. <p>Indicates that a particular call timed out.</p>
  427. </dd></dl>
  428. </div>
  429. <div class="section" id="module-grpc.framework.foundation.later">
  430. <span id="grpc-framework-foundation-later-module"></span><h2>grpc.framework.foundation.later module<a class="headerlink" href="#module-grpc.framework.foundation.later" title="Permalink to this headline">¶</a></h2>
  431. <p>Enables scheduling execution at a later time.</p>
  432. <dl class="function">
  433. <dt id="grpc.framework.foundation.later.later">
  434. <code class="descclassname">grpc.framework.foundation.later.</code><code class="descname">later</code><span class="sig-paren">(</span><em>delay</em>, <em>computation</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/later.html#later"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.later.later" title="Permalink to this definition">¶</a></dt>
  435. <dd><p>Schedules later execution of a callable.</p>
  436. <table class="docutils field-list" frame="void" rules="none">
  437. <col class="field-name" />
  438. <col class="field-body" />
  439. <tbody valign="top">
  440. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  441. <li><strong>delay</strong> &#8211; Any numeric value. Represents the minimum length of time in seconds
  442. to allow to pass before beginning the computation. No guarantees are made
  443. about the maximum length of time that will pass.</li>
  444. <li><strong>computation</strong> &#8211; A callable that accepts no arguments.</li>
  445. </ul>
  446. </td>
  447. </tr>
  448. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Future representing the scheduled computation.</p>
  449. </td>
  450. </tr>
  451. </tbody>
  452. </table>
  453. </dd></dl>
  454. </div>
  455. <div class="section" id="module-grpc.framework.foundation.logging_pool">
  456. <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>
  457. <p>A thread pool that logs exceptions raised by tasks executed within it.</p>
  458. <dl class="function">
  459. <dt id="grpc.framework.foundation.logging_pool.pool">
  460. <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>
  461. <dd><p>Creates a thread pool that logs exceptions raised by the tasks within it.</p>
  462. <table class="docutils field-list" frame="void" rules="none">
  463. <col class="field-name" />
  464. <col class="field-body" />
  465. <tbody valign="top">
  466. <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>
  467. </tr>
  468. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A futures.ThreadPoolExecutor-compatible thread pool that logs exceptions
  469. raised by the tasks executed within it.</td>
  470. </tr>
  471. </tbody>
  472. </table>
  473. </dd></dl>
  474. </div>
  475. <div class="section" id="module-grpc.framework.foundation.relay">
  476. <span id="grpc-framework-foundation-relay-module"></span><h2>grpc.framework.foundation.relay module<a class="headerlink" href="#module-grpc.framework.foundation.relay" title="Permalink to this headline">¶</a></h2>
  477. <p>Implementations of in-order work deference.</p>
  478. <dl class="class">
  479. <dt id="grpc.framework.foundation.relay.Relay">
  480. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.relay.</code><code class="descname">Relay</code><a class="reference internal" href="_modules/grpc/framework/foundation/relay.html#Relay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.relay.Relay" title="Permalink to this definition">¶</a></dt>
  481. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  482. <p>Performs work submitted to it in another thread.</p>
  483. <p>Performs work in the order in which work was submitted to it; otherwise there
  484. would be no reason to use an implementation of this interface instead of a
  485. thread pool.</p>
  486. <dl class="method">
  487. <dt id="grpc.framework.foundation.relay.Relay.add_value">
  488. <code class="descname">add_value</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/relay.html#Relay.add_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.relay.Relay.add_value" title="Permalink to this definition">¶</a></dt>
  489. <dd><p>Adds a value to be passed to the behavior registered with this Relay.</p>
  490. <table class="docutils field-list" frame="void" rules="none">
  491. <col class="field-name" />
  492. <col class="field-body" />
  493. <tbody valign="top">
  494. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> &#8211; A value that will be passed to a call made in another thread to the
  495. behavior registered with this Relay.</td>
  496. </tr>
  497. </tbody>
  498. </table>
  499. </dd></dl>
  500. <dl class="method">
  501. <dt id="grpc.framework.foundation.relay.Relay.set_behavior">
  502. <code class="descname">set_behavior</code><span class="sig-paren">(</span><em>behavior</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/relay.html#Relay.set_behavior"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.relay.Relay.set_behavior" title="Permalink to this definition">¶</a></dt>
  503. <dd><p>Sets the behavior that this Relay should call when passed values.</p>
  504. <table class="docutils field-list" frame="void" rules="none">
  505. <col class="field-name" />
  506. <col class="field-body" />
  507. <tbody valign="top">
  508. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>behavior</strong> &#8211; The behavior that this Relay should call in another thread when
  509. passed a value, or None to have passed values ignored.</td>
  510. </tr>
  511. </tbody>
  512. </table>
  513. </dd></dl>
  514. </dd></dl>
  515. <dl class="function">
  516. <dt id="grpc.framework.foundation.relay.pool_relay">
  517. <code class="descclassname">grpc.framework.foundation.relay.</code><code class="descname">pool_relay</code><span class="sig-paren">(</span><em>pool</em>, <em>behavior</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/relay.html#pool_relay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.relay.pool_relay" title="Permalink to this definition">¶</a></dt>
  518. <dd><p>Creates a Relay that uses a given thread pool.</p>
  519. <p>This object will make use of at most one thread in the given pool.</p>
  520. <table class="docutils field-list" frame="void" rules="none">
  521. <col class="field-name" />
  522. <col class="field-body" />
  523. <tbody valign="top">
  524. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  525. <li><strong>pool</strong> &#8211; A futures.ThreadPoolExecutor for use by the created Relay.</li>
  526. <li><strong>behavior</strong> &#8211; The behavior to be called by the created Relay, or None to have
  527. passed values dropped until a different behavior is given to the returned
  528. Relay later.</li>
  529. </ul>
  530. </td>
  531. </tr>
  532. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An object that is both an activated.Activated and a Relay. The object is
  533. only valid for use as a Relay when activated.</p>
  534. </td>
  535. </tr>
  536. </tbody>
  537. </table>
  538. </dd></dl>
  539. <dl class="function">
  540. <dt id="grpc.framework.foundation.relay.relay">
  541. <code class="descclassname">grpc.framework.foundation.relay.</code><code class="descname">relay</code><span class="sig-paren">(</span><em>behavior</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/relay.html#relay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.relay.relay" title="Permalink to this definition">¶</a></dt>
  542. <dd><p>Creates a Relay.</p>
  543. <table class="docutils field-list" frame="void" rules="none">
  544. <col class="field-name" />
  545. <col class="field-body" />
  546. <tbody valign="top">
  547. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>behavior</strong> &#8211; The behavior to be called by the created Relay, or None to have
  548. passed values dropped until a different behavior is given to the returned
  549. Relay later.</td>
  550. </tr>
  551. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">An object that is both an activated.Activated and a Relay. The object is
  552. only valid for use as a Relay when activated.</td>
  553. </tr>
  554. </tbody>
  555. </table>
  556. </dd></dl>
  557. </div>
  558. <div class="section" id="module-grpc.framework.foundation.stream">
  559. <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>
  560. <p>Interfaces related to streams of values or objects.</p>
  561. <dl class="class">
  562. <dt id="grpc.framework.foundation.stream.Consumer">
  563. <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>
  564. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  565. <p>Interface for consumers of finite streams of values or objects.</p>
  566. <dl class="method">
  567. <dt id="grpc.framework.foundation.stream.Consumer.consume">
  568. <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>
  569. <dd><p>Accepts a value.</p>
  570. <table class="docutils field-list" frame="void" rules="none">
  571. <col class="field-name" />
  572. <col class="field-body" />
  573. <tbody valign="top">
  574. <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>
  575. </tr>
  576. </tbody>
  577. </table>
  578. </dd></dl>
  579. <dl class="method">
  580. <dt id="grpc.framework.foundation.stream.Consumer.consume_and_terminate">
  581. <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>
  582. <dd><p>Supplies a value and signals that no more values will be supplied.</p>
  583. <table class="docutils field-list" frame="void" rules="none">
  584. <col class="field-name" />
  585. <col class="field-body" />
  586. <tbody valign="top">
  587. <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>
  588. </tr>
  589. </tbody>
  590. </table>
  591. </dd></dl>
  592. <dl class="method">
  593. <dt id="grpc.framework.foundation.stream.Consumer.terminate">
  594. <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>
  595. <dd><p>Indicates to this Consumer that no more values will be supplied.</p>
  596. </dd></dl>
  597. </dd></dl>
  598. </div>
  599. <div class="section" id="module-grpc.framework.foundation.stream_testing">
  600. <span id="grpc-framework-foundation-stream-testing-module"></span><h2>grpc.framework.foundation.stream_testing module<a class="headerlink" href="#module-grpc.framework.foundation.stream_testing" title="Permalink to this headline">¶</a></h2>
  601. <p>Utilities for testing stream-related code.</p>
  602. <dl class="class">
  603. <dt id="grpc.framework.foundation.stream_testing.TestConsumer">
  604. <em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream_testing.</code><code class="descname">TestConsumer</code><a class="reference internal" href="_modules/grpc/framework/foundation/stream_testing.html#TestConsumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_testing.TestConsumer" title="Permalink to this definition">¶</a></dt>
  605. <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>
  606. <p>A stream.Consumer instrumented for testing.</p>
  607. <dl class="attribute">
  608. <dt id="grpc.framework.foundation.stream_testing.TestConsumer.calls">
  609. <code class="descname">calls</code><a class="headerlink" href="#grpc.framework.foundation.stream_testing.TestConsumer.calls" title="Permalink to this definition">¶</a></dt>
  610. <dd><p>A sequence of value-termination pairs describing the history of calls
  611. made on this object.</p>
  612. </dd></dl>
  613. <dl class="method">
  614. <dt id="grpc.framework.foundation.stream_testing.TestConsumer.consume">
  615. <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_testing.html#TestConsumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_testing.TestConsumer.consume" title="Permalink to this definition">¶</a></dt>
  616. <dd><p>See stream.Consumer.consume for specification.</p>
  617. </dd></dl>
  618. <dl class="method">
  619. <dt id="grpc.framework.foundation.stream_testing.TestConsumer.consume_and_terminate">
  620. <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_testing.html#TestConsumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_testing.TestConsumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt>
  621. <dd><p>See stream.Consumer.consume_and_terminate for specification.</p>
  622. </dd></dl>
  623. <dl class="method">
  624. <dt id="grpc.framework.foundation.stream_testing.TestConsumer.is_legal">
  625. <code class="descname">is_legal</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_testing.html#TestConsumer.is_legal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_testing.TestConsumer.is_legal" title="Permalink to this definition">¶</a></dt>
  626. <dd><p>Reports whether or not a legal sequence of calls has been made.</p>
  627. </dd></dl>
  628. <dl class="method">
  629. <dt id="grpc.framework.foundation.stream_testing.TestConsumer.terminate">
  630. <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_testing.html#TestConsumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_testing.TestConsumer.terminate" title="Permalink to this definition">¶</a></dt>
  631. <dd><p>See stream.Consumer.terminate for specification.</p>
  632. </dd></dl>
  633. <dl class="method">
  634. <dt id="grpc.framework.foundation.stream_testing.TestConsumer.values">
  635. <code class="descname">values</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_testing.html#TestConsumer.values"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_testing.TestConsumer.values" title="Permalink to this definition">¶</a></dt>
  636. <dd><p>Returns the sequence of values that have been passed to this Consumer.</p>
  637. </dd></dl>
  638. </dd></dl>
  639. </div>
  640. <div class="section" id="module-grpc.framework.foundation.stream_util">
  641. <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>
  642. <p>Helpful utilities related to the stream module.</p>
  643. <dl class="class">
  644. <dt id="grpc.framework.foundation.stream_util.IterableConsumer">
  645. <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>
  646. <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>
  647. <p>A Consumer that when iterated over emits the values it has consumed.</p>
  648. <dl class="method">
  649. <dt id="grpc.framework.foundation.stream_util.IterableConsumer.consume">
  650. <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>
  651. <dd></dd></dl>
  652. <dl class="method">
  653. <dt id="grpc.framework.foundation.stream_util.IterableConsumer.consume_and_terminate">
  654. <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>
  655. <dd></dd></dl>
  656. <dl class="method">
  657. <dt id="grpc.framework.foundation.stream_util.IterableConsumer.next">
  658. <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>
  659. <dd></dd></dl>
  660. <dl class="method">
  661. <dt id="grpc.framework.foundation.stream_util.IterableConsumer.terminate">
  662. <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>
  663. <dd></dd></dl>
  664. </dd></dl>
  665. <dl class="class">
  666. <dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer">
  667. <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>
  668. <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>
  669. <p>A Consumer decorator that affords serialization and asynchrony.</p>
  670. <dl class="method">
  671. <dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume">
  672. <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>
  673. <dd></dd></dl>
  674. <dl class="method">
  675. <dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume_and_terminate">
  676. <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>
  677. <dd></dd></dl>
  678. <dl class="method">
  679. <dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.terminate">
  680. <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>
  681. <dd></dd></dl>
  682. </dd></dl>
  683. <dl class="class">
  684. <dt id="grpc.framework.foundation.stream_util.TransformingConsumer">
  685. <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>
  686. <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>
  687. <p>A stream.Consumer that passes a transformation of its input to another.</p>
  688. <dl class="method">
  689. <dt id="grpc.framework.foundation.stream_util.TransformingConsumer.consume">
  690. <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>
  691. <dd></dd></dl>
  692. <dl class="method">
  693. <dt id="grpc.framework.foundation.stream_util.TransformingConsumer.consume_and_terminate">
  694. <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>
  695. <dd></dd></dl>
  696. <dl class="method">
  697. <dt id="grpc.framework.foundation.stream_util.TransformingConsumer.terminate">
  698. <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>
  699. <dd></dd></dl>
  700. </dd></dl>
  701. </div>
  702. <div class="section" id="module-grpc.framework.foundation">
  703. <span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-grpc.framework.foundation" title="Permalink to this headline">¶</a></h2>
  704. </div>
  705. </div>
  706. </div>
  707. <footer>
  708. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  709. <a href="grpc.framework.interfaces.html" class="btn btn-neutral float-right" title="grpc.framework.interfaces package" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
  710. <a href="grpc.framework.face.testing.html" class="btn btn-neutral" title="grpc.framework.face.testing package" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
  711. </div>
  712. <hr/>
  713. <div role="contentinfo">
  714. <p>
  715. &copy; Copyright 2015, Author.
  716. </p>
  717. </div>
  718. 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>.
  719. </footer>
  720. </div>
  721. </div>
  722. </section>
  723. </div>
  724. <script type="text/javascript">
  725. var DOCUMENTATION_OPTIONS = {
  726. URL_ROOT:'./',
  727. VERSION:'0.10.0a0',
  728. COLLAPSE_INDEX:false,
  729. FILE_SUFFIX:'.html',
  730. HAS_SOURCE: true
  731. };
  732. </script>
  733. <script type="text/javascript" src="_static/jquery.js"></script>
  734. <script type="text/javascript" src="_static/underscore.js"></script>
  735. <script type="text/javascript" src="_static/doctools.js"></script>
  736. <script type="text/javascript" src="_static/js/theme.js"></script>
  737. <script type="text/javascript">
  738. jQuery(function () {
  739. SphinxRtdTheme.StickyNav.enable();
  740. });
  741. </script>
  742. </body>
  743. </html>