123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- <!DOCTYPE html>
- <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
- <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
- <head>
- <meta charset="utf-8">
-
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <title>grpc.framework.interfaces.links.links — grpcio 0.13.1rc1 documentation</title>
-
-
-
-
-
-
-
-
-
-
- <link rel="stylesheet" href="../../../../../_static/css/theme.css" type="text/css" />
-
-
-
- <link rel="top" title="grpcio 0.13.1rc1 documentation" href="../../../../../index.html"/>
- <link rel="up" title="Module code" href="../../../../index.html"/>
-
- <script src="../../../../../_static/js/modernizr.min.js"></script>
- </head>
- <body class="wy-body-for-nav" role="document">
- <div class="wy-grid-for-nav">
-
- <nav data-toggle="wy-nav-shift" class="wy-nav-side">
- <div class="wy-side-scroll">
- <div class="wy-side-nav-search">
-
-
- <a href="../../../../../index.html" class="icon icon-home"> grpcio
-
-
- </a>
-
-
-
- <div class="version">
- 0.13.1rc1
- </div>
-
-
-
- <div role="search">
- <form id="rtd-search-form" class="wy-form" action="../../../../../search.html" method="get">
- <input type="text" name="q" placeholder="Search docs" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
-
- </div>
- <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
-
-
-
- <ul>
- <li class="toctree-l1"><a class="reference internal" href="../../../../../grpc.html">grpc package</a></li>
- </ul>
-
-
- </div>
- </div>
- </nav>
- <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
-
- <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
- <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
- <a href="../../../../../index.html">grpcio</a>
- </nav>
-
- <div class="wy-nav-content">
- <div class="rst-content">
-
- <div role="navigation" aria-label="breadcrumbs navigation">
- <ul class="wy-breadcrumbs">
- <li><a href="../../../../../index.html">Docs</a> »</li>
-
- <li><a href="../../../../index.html">Module code</a> »</li>
-
- <li>grpc.framework.interfaces.links.links</li>
- <li class="wy-breadcrumbs-aside">
-
-
-
- </li>
- </ul>
- <hr/>
- </div>
- <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
- <div itemprop="articleBody">
-
- <h1>Source code for grpc.framework.interfaces.links.links</h1><div class="highlight"><pre>
- <span></span><span class="c1"># Copyright 2015, Google Inc.</span>
- <span class="c1"># All rights reserved.</span>
- <span class="c1">#</span>
- <span class="c1"># Redistribution and use in source and binary forms, with or without</span>
- <span class="c1"># modification, are permitted provided that the following conditions are</span>
- <span class="c1"># met:</span>
- <span class="c1">#</span>
- <span class="c1"># * Redistributions of source code must retain the above copyright</span>
- <span class="c1"># notice, this list of conditions and the following disclaimer.</span>
- <span class="c1"># * Redistributions in binary form must reproduce the above</span>
- <span class="c1"># copyright notice, this list of conditions and the following disclaimer</span>
- <span class="c1"># in the documentation and/or other materials provided with the</span>
- <span class="c1"># distribution.</span>
- <span class="c1"># * Neither the name of Google Inc. nor the names of its</span>
- <span class="c1"># contributors may be used to endorse or promote products derived from</span>
- <span class="c1"># this software without specific prior written permission.</span>
- <span class="c1">#</span>
- <span class="c1"># THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span>
- <span class="c1"># "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span>
- <span class="c1"># LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span>
- <span class="c1"># A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT</span>
- <span class="c1"># OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
- <span class="c1"># SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span>
- <span class="c1"># LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span>
- <span class="c1"># DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY</span>
- <span class="c1"># THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span>
- <span class="c1"># (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span>
- <span class="c1"># OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
- <span class="sd">"""The low-level ticket-exchanging-links interface of RPC Framework."""</span>
- <span class="kn">import</span> <span class="nn">abc</span>
- <span class="kn">import</span> <span class="nn">collections</span>
- <span class="kn">import</span> <span class="nn">enum</span>
- <div class="viewcode-block" id="Protocol"><a class="viewcode-back" href="../../../../../grpc.framework.interfaces.links.html#grpc.framework.interfaces.links.links.Protocol">[docs]</a><span class="k">class</span> <span class="nc">Protocol</span><span class="p">(</span><span class="n">collections</span><span class="o">.</span><span class="n">namedtuple</span><span class="p">(</span><span class="s1">'Protocol'</span><span class="p">,</span> <span class="p">(</span><span class="s1">'kind'</span><span class="p">,</span> <span class="s1">'value'</span><span class="p">,))):</span>
- <span class="sd">"""A sum type for handles to a system that transmits tickets.</span>
- <span class="sd"> Attributes:</span>
- <span class="sd"> kind: A Kind value identifying the kind of value being passed.</span>
- <span class="sd"> value: The value being passed between the high-level application and the</span>
- <span class="sd"> system affording ticket transport.</span>
- <span class="sd"> """</span>
- <span class="nd">@enum</span><span class="o">.</span><span class="n">unique</span>
- <div class="viewcode-block" id="Protocol.Kind"><a class="viewcode-back" href="../../../../../grpc.framework.interfaces.links.html#grpc.framework.interfaces.links.links.Protocol.Kind">[docs]</a> <span class="k">class</span> <span class="nc">Kind</span><span class="p">(</span><span class="n">enum</span><span class="o">.</span><span class="n">Enum</span><span class="p">):</span>
- <span class="n">CALL_OPTION</span> <span class="o">=</span> <span class="s1">'call option'</span>
- <span class="n">SERVICER_CONTEXT</span> <span class="o">=</span> <span class="s1">'servicer context'</span>
- <span class="n">INVOCATION_CONTEXT</span> <span class="o">=</span> <span class="s1">'invocation context'</span></div></div>
- <div class="viewcode-block" id="Ticket"><a class="viewcode-back" href="../../../../../grpc.framework.interfaces.links.html#grpc.framework.interfaces.links.links.Ticket">[docs]</a><span class="k">class</span> <span class="nc">Ticket</span><span class="p">(</span>
- <span class="n">collections</span><span class="o">.</span><span class="n">namedtuple</span><span class="p">(</span>
- <span class="s1">'Ticket'</span><span class="p">,</span>
- <span class="p">(</span><span class="s1">'operation_id'</span><span class="p">,</span> <span class="s1">'sequence_number'</span><span class="p">,</span> <span class="s1">'group'</span><span class="p">,</span> <span class="s1">'method'</span><span class="p">,</span> <span class="s1">'subscription'</span><span class="p">,</span>
- <span class="s1">'timeout'</span><span class="p">,</span> <span class="s1">'allowance'</span><span class="p">,</span> <span class="s1">'initial_metadata'</span><span class="p">,</span> <span class="s1">'payload'</span><span class="p">,</span>
- <span class="s1">'terminal_metadata'</span><span class="p">,</span> <span class="s1">'code'</span><span class="p">,</span> <span class="s1">'message'</span><span class="p">,</span> <span class="s1">'termination'</span><span class="p">,</span> <span class="s1">'protocol'</span><span class="p">,))):</span>
- <span class="sd">"""A sum type for all values sent from a front to a back.</span>
- <span class="sd"> Attributes:</span>
- <span class="sd"> operation_id: A unique-with-respect-to-equality hashable object identifying</span>
- <span class="sd"> a particular operation.</span>
- <span class="sd"> sequence_number: A zero-indexed integer sequence number identifying the</span>
- <span class="sd"> ticket's place in the stream of tickets sent in one direction for the</span>
- <span class="sd"> particular operation.</span>
- <span class="sd"> group: The group to which the method of the operation belongs. Must be</span>
- <span class="sd"> present in the first ticket from invocation side to service side. Ignored</span>
- <span class="sd"> for all other tickets exchanged during the operation.</span>
- <span class="sd"> method: The name of an operation. Must be present in the first ticket from</span>
- <span class="sd"> invocation side to service side. Ignored for all other tickets exchanged</span>
- <span class="sd"> during the operation.</span>
- <span class="sd"> subscription: A Subscription value describing the interest one side has in</span>
- <span class="sd"> receiving information from the other side. Must be present in the first</span>
- <span class="sd"> ticket from either side. Ignored for all other tickets exchanged during</span>
- <span class="sd"> the operation.</span>
- <span class="sd"> timeout: A nonzero length of time (measured from the beginning of the</span>
- <span class="sd"> operation) to allow for the entire operation. Must be present in the first</span>
- <span class="sd"> ticket from invocation side to service side. Optional for all other</span>
- <span class="sd"> tickets exchanged during the operation. Receipt of a value from the other</span>
- <span class="sd"> side of the operation indicates the value in use by that side. Setting a</span>
- <span class="sd"> value on a later ticket allows either side to request time extensions (or</span>
- <span class="sd"> even time reductions!) on in-progress operations.</span>
- <span class="sd"> allowance: A positive integer granting permission for a number of payloads</span>
- <span class="sd"> to be transmitted to the communicating side of the operation, or None if</span>
- <span class="sd"> no additional allowance is being granted with this ticket.</span>
- <span class="sd"> initial_metadata: An optional metadata value communicated from one side to</span>
- <span class="sd"> the other at the beginning of the operation. May be non-None in at most</span>
- <span class="sd"> one ticket from each side. Any non-None value must appear no later than</span>
- <span class="sd"> the first payload value.</span>
- <span class="sd"> payload: A customer payload object. May be None.</span>
- <span class="sd"> terminal_metadata: A metadata value comminicated from one side to the other</span>
- <span class="sd"> at the end of the operation. May be non-None in the same ticket as</span>
- <span class="sd"> the code and message, but must be None for all earlier tickets.</span>
- <span class="sd"> code: A value communicated at operation completion. May be None.</span>
- <span class="sd"> message: A value communicated at operation completion. May be None.</span>
- <span class="sd"> termination: A Termination value describing the end of the operation, or</span>
- <span class="sd"> None if the operation has not yet terminated. If set, no further tickets</span>
- <span class="sd"> may be sent in the same direction.</span>
- <span class="sd"> protocol: A Protocol value or None, with further semantics being a matter</span>
- <span class="sd"> between high-level application and underlying ticket transport.</span>
- <span class="sd"> """</span>
- <span class="nd">@enum</span><span class="o">.</span><span class="n">unique</span>
- <div class="viewcode-block" id="Ticket.Subscription"><a class="viewcode-back" href="../../../../../grpc.framework.interfaces.links.html#grpc.framework.interfaces.links.links.Ticket.Subscription">[docs]</a> <span class="k">class</span> <span class="nc">Subscription</span><span class="p">(</span><span class="n">enum</span><span class="o">.</span><span class="n">Enum</span><span class="p">):</span>
- <span class="sd">"""Identifies the level of subscription of a side of an operation."""</span>
- <span class="n">NONE</span> <span class="o">=</span> <span class="s1">'none'</span>
- <span class="n">TERMINATION</span> <span class="o">=</span> <span class="s1">'termination'</span>
- <span class="n">FULL</span> <span class="o">=</span> <span class="s1">'full'</span></div>
- <span class="nd">@enum</span><span class="o">.</span><span class="n">unique</span>
- <div class="viewcode-block" id="Ticket.Termination"><a class="viewcode-back" href="../../../../../grpc.framework.interfaces.links.html#grpc.framework.interfaces.links.links.Ticket.Termination">[docs]</a> <span class="k">class</span> <span class="nc">Termination</span><span class="p">(</span><span class="n">enum</span><span class="o">.</span><span class="n">Enum</span><span class="p">):</span>
- <span class="sd">"""Identifies the termination of an operation."""</span>
- <span class="n">COMPLETION</span> <span class="o">=</span> <span class="s1">'completion'</span>
- <span class="n">CANCELLATION</span> <span class="o">=</span> <span class="s1">'cancellation'</span>
- <span class="n">EXPIRATION</span> <span class="o">=</span> <span class="s1">'expiration'</span>
- <span class="n">SHUTDOWN</span> <span class="o">=</span> <span class="s1">'shutdown'</span>
- <span class="n">RECEPTION_FAILURE</span> <span class="o">=</span> <span class="s1">'reception failure'</span>
- <span class="n">TRANSMISSION_FAILURE</span> <span class="o">=</span> <span class="s1">'transmission failure'</span>
- <span class="n">LOCAL_FAILURE</span> <span class="o">=</span> <span class="s1">'local failure'</span>
- <span class="n">REMOTE_FAILURE</span> <span class="o">=</span> <span class="s1">'remote failure'</span></div></div>
- <div class="viewcode-block" id="Link"><a class="viewcode-back" href="../../../../../grpc.framework.interfaces.links.html#grpc.framework.interfaces.links.links.Link">[docs]</a><span class="k">class</span> <span class="nc">Link</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
- <span class="sd">"""Accepts and emits tickets."""</span>
- <span class="n">__metaclass__</span> <span class="o">=</span> <span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span>
- <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
- <div class="viewcode-block" id="Link.accept_ticket"><a class="viewcode-back" href="../../../../../grpc.framework.interfaces.links.html#grpc.framework.interfaces.links.links.Link.accept_ticket">[docs]</a> <span class="k">def</span> <span class="nf">accept_ticket</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ticket</span><span class="p">):</span>
- <span class="sd">"""Accept a Ticket.</span>
- <span class="sd"> Args:</span>
- <span class="sd"> ticket: Any Ticket.</span>
- <span class="sd"> """</span>
- <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div>
- <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
- <div class="viewcode-block" id="Link.join_link"><a class="viewcode-back" href="../../../../../grpc.framework.interfaces.links.html#grpc.framework.interfaces.links.links.Link.join_link">[docs]</a> <span class="k">def</span> <span class="nf">join_link</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">link</span><span class="p">):</span>
- <span class="sd">"""Mates this object with a peer with which it will exchange tickets."""</span>
- <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span></div></div>
- </pre></div>
- </div>
- </div>
- <footer>
-
- <hr/>
- <div role="contentinfo">
- <p>
- © Copyright 2016, Author.
- </p>
- </div>
- 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>.
- </footer>
- </div>
- </div>
- </section>
- </div>
-
-
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT:'../../../../../',
- VERSION:'0.13.1rc1',
- COLLAPSE_INDEX:false,
- FILE_SUFFIX:'.html',
- HAS_SOURCE: true
- };
- </script>
- <script type="text/javascript" src="../../../../../_static/jquery.js"></script>
- <script type="text/javascript" src="../../../../../_static/underscore.js"></script>
- <script type="text/javascript" src="../../../../../_static/doctools.js"></script>
-
-
-
- <script type="text/javascript" src="../../../../../_static/js/theme.js"></script>
-
-
-
- <script type="text/javascript">
- jQuery(function () {
- SphinxRtdTheme.StickyNav.enable();
- });
- </script>
-
- </body>
- </html>
|