stream.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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.stream &mdash; grpcio 0.11.0b1 documentation</title>
  8. <link rel="stylesheet" href="../../../../_static/css/theme.css" type="text/css" />
  9. <link rel="top" title="grpcio 0.11.0b1 documentation" href="../../../../index.html"/>
  10. <link rel="up" title="Module code" href="../../../index.html"/>
  11. <script src="../../../../_static/js/modernizr.min.js"></script>
  12. </head>
  13. <body class="wy-body-for-nav" role="document">
  14. <div class="wy-grid-for-nav">
  15. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  16. <div class="wy-side-scroll">
  17. <div class="wy-side-nav-search">
  18. <a href="../../../../index.html" class="icon icon-home"> grpcio
  19. </a>
  20. <div class="version">
  21. 0.11.0b1
  22. </div>
  23. <div role="search">
  24. <form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
  25. <input type="text" name="q" placeholder="Search docs" />
  26. <input type="hidden" name="check_keywords" value="yes" />
  27. <input type="hidden" name="area" value="default" />
  28. </form>
  29. </div>
  30. </div>
  31. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  32. <ul>
  33. <li class="toctree-l1"><a class="reference internal" href="../../../../grpc.html">grpc package</a></li>
  34. </ul>
  35. </div>
  36. </div>
  37. </nav>
  38. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  39. <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
  40. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  41. <a href="../../../../index.html">grpcio</a>
  42. </nav>
  43. <div class="wy-nav-content">
  44. <div class="rst-content">
  45. <div role="navigation" aria-label="breadcrumbs navigation">
  46. <ul class="wy-breadcrumbs">
  47. <li><a href="../../../../index.html">Docs</a> &raquo;</li>
  48. <li><a href="../../../index.html">Module code</a> &raquo;</li>
  49. <li>grpc.framework.foundation.stream</li>
  50. <li class="wy-breadcrumbs-aside">
  51. </li>
  52. </ul>
  53. <hr/>
  54. </div>
  55. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  56. <div itemprop="articleBody">
  57. <h1>Source code for grpc.framework.foundation.stream</h1><div class="highlight"><pre>
  58. <span class="c"># Copyright 2015, Google Inc.</span>
  59. <span class="c"># All rights reserved.</span>
  60. <span class="c">#</span>
  61. <span class="c"># Redistribution and use in source and binary forms, with or without</span>
  62. <span class="c"># modification, are permitted provided that the following conditions are</span>
  63. <span class="c"># met:</span>
  64. <span class="c">#</span>
  65. <span class="c"># * Redistributions of source code must retain the above copyright</span>
  66. <span class="c"># notice, this list of conditions and the following disclaimer.</span>
  67. <span class="c"># * Redistributions in binary form must reproduce the above</span>
  68. <span class="c"># copyright notice, this list of conditions and the following disclaimer</span>
  69. <span class="c"># in the documentation and/or other materials provided with the</span>
  70. <span class="c"># distribution.</span>
  71. <span class="c"># * Neither the name of Google Inc. nor the names of its</span>
  72. <span class="c"># contributors may be used to endorse or promote products derived from</span>
  73. <span class="c"># this software without specific prior written permission.</span>
  74. <span class="c">#</span>
  75. <span class="c"># THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span>
  76. <span class="c"># &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span>
  77. <span class="c"># LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span>
  78. <span class="c"># A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT</span>
  79. <span class="c"># OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
  80. <span class="c"># SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span>
  81. <span class="c"># LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span>
  82. <span class="c"># DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY</span>
  83. <span class="c"># THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span>
  84. <span class="c"># (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span>
  85. <span class="c"># OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
  86. <span class="sd">&quot;&quot;&quot;Interfaces related to streams of values or objects.&quot;&quot;&quot;</span>
  87. <span class="kn">import</span> <span class="nn">abc</span>
  88. <div class="viewcode-block" id="Consumer"><a class="viewcode-back" href="../../../../grpc.framework.foundation.html#grpc.framework.foundation.stream.Consumer">[docs]</a><span class="k">class</span> <span class="nc">Consumer</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
  89. <span class="sd">&quot;&quot;&quot;Interface for consumers of finite streams of values or objects.&quot;&quot;&quot;</span>
  90. <span class="n">__metaclass__</span> <span class="o">=</span> <span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span>
  91. <span class="nd">@abc.abstractmethod</span>
  92. <div class="viewcode-block" id="Consumer.consume"><a class="viewcode-back" href="../../../../grpc.framework.foundation.html#grpc.framework.foundation.stream.Consumer.consume">[docs]</a> <span class="k">def</span> <span class="nf">consume</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
  93. <span class="sd">&quot;&quot;&quot;Accepts a value.</span>
  94. <span class="sd"> Args:</span>
  95. <span class="sd"> value: Any value accepted by this Consumer.</span>
  96. <span class="sd"> &quot;&quot;&quot;</span>
  97. <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
  98. </div>
  99. <span class="nd">@abc.abstractmethod</span>
  100. <div class="viewcode-block" id="Consumer.terminate"><a class="viewcode-back" href="../../../../grpc.framework.foundation.html#grpc.framework.foundation.stream.Consumer.terminate">[docs]</a> <span class="k">def</span> <span class="nf">terminate</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
  101. <span class="sd">&quot;&quot;&quot;Indicates to this Consumer that no more values will be supplied.&quot;&quot;&quot;</span>
  102. <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
  103. </div>
  104. <span class="nd">@abc.abstractmethod</span>
  105. <div class="viewcode-block" id="Consumer.consume_and_terminate"><a class="viewcode-back" href="../../../../grpc.framework.foundation.html#grpc.framework.foundation.stream.Consumer.consume_and_terminate">[docs]</a> <span class="k">def</span> <span class="nf">consume_and_terminate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
  106. <span class="sd">&quot;&quot;&quot;Supplies a value and signals that no more values will be supplied.</span>
  107. <span class="sd"> Args:</span>
  108. <span class="sd"> value: Any value accepted by this Consumer.</span>
  109. <span class="sd"> &quot;&quot;&quot;</span>
  110. <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div></div>
  111. </pre></div>
  112. </div>
  113. </div>
  114. <footer>
  115. <hr/>
  116. <div role="contentinfo">
  117. <p>
  118. &copy; Copyright 2015, Author.
  119. </p>
  120. </div>
  121. 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>.
  122. </footer>
  123. </div>
  124. </div>
  125. </section>
  126. </div>
  127. <script type="text/javascript">
  128. var DOCUMENTATION_OPTIONS = {
  129. URL_ROOT:'../../../../',
  130. VERSION:'0.11.0b1',
  131. COLLAPSE_INDEX:false,
  132. FILE_SUFFIX:'.html',
  133. HAS_SOURCE: true
  134. };
  135. </script>
  136. <script type="text/javascript" src="../../../../_static/jquery.js"></script>
  137. <script type="text/javascript" src="../../../../_static/underscore.js"></script>
  138. <script type="text/javascript" src="../../../../_static/doctools.js"></script>
  139. <script type="text/javascript" src="../../../../_static/js/theme.js"></script>
  140. <script type="text/javascript">
  141. jQuery(function () {
  142. SphinxRtdTheme.StickyNav.enable();
  143. });
  144. </script>
  145. </body>
  146. </html>