14 """Constants and interfaces of the Beta API of gRPC Python."""
23 ChannelConnectivity.FATAL_FAILURE = ChannelConnectivity.SHUTDOWN
29 """A value encapsulating gRPC-specific options passed on RPC invocation.
31 This class and its instances have no supported interface - it exists to
32 define the type of its instances and its instances exist to be passed to
36 def __init__(self, disable_compression, subcall_of, credentials):
43 """Creates a GRPCCallOptions value to be passed at RPC invocation.
45 All parameters are optional and should always be passed by keyword.
48 disable_compression: A boolean indicating whether or not compression should
49 be disabled for the request object of the RPC. Only valid for
51 credentials: A CallCredentials object to use for the invoked RPC.
62 """Exposes gRPC-specific options and behaviors to code servicing RPCs."""
66 """Identifies the peer that invoked the RPC being serviced.
69 A string identifying the peer that invoked the RPC being serviced.
71 raise NotImplementedError()
75 """Disables compression of the next response passed by the application."""
76 raise NotImplementedError()
80 """Exposes gRPC-specific options and behaviors to code invoking RPCs."""
84 """Disables compression of the next request passed by the application."""
85 raise NotImplementedError()
88 class Server(six.with_metaclass(abc.ABCMeta)):
93 """Reserves a port for insecure RPC service once this Server becomes active.
95 This method may only be called before calling this Server's start method is
99 address: The address for which to open a port.
102 An integer port on which RPCs will be serviced after this link has been
103 started. This is typically the same number as the port number contained
104 in the passed address, but will likely be different if the port number
105 contained in the passed address was zero.
107 raise NotImplementedError()
111 """Reserves a port for secure RPC service after this Server becomes active.
113 This method may only be called before calling this Server's start method is
117 address: The address for which to open a port.
118 server_credentials: A ServerCredentials.
121 An integer port on which RPCs will be serviced after this link has been
122 started. This is typically the same number as the port number contained
123 in the passed address, but will likely be different if the port number
124 contained in the passed address was zero.
126 raise NotImplementedError()
130 """Starts this Server's service of RPCs.
132 This method may only be called while the server is not serving RPCs (i.e. it
135 raise NotImplementedError()
139 """Stops this Server's service of RPCs.
141 All calls to this method immediately stop service of new RPCs. When existing
142 RPCs are aborted is controlled by the grace period parameter passed to this
145 This method may be called at any time and is idempotent. Passing a smaller
146 grace value than has been passed in a previous call will have the effect of
147 stopping the Server sooner. Passing a larger grace value than has been
148 passed in a previous call will not have the effect of stopping the server
152 grace: A duration of time in seconds to allow existing RPCs to complete
153 before being aborted by this Server's stopping. May be zero for
154 immediate abortion of all in-progress RPCs.
157 A threading.Event that will be set when this Server has completely
158 stopped. The returned event may not be set until after the full grace
159 period (if some ongoing RPC continues for the full length of the period)
160 of it may be set much sooner (such as if this Server had no RPCs underway
161 at the time it was stopped or if all RPCs that it had underway completed
162 very early in the grace period).
164 raise NotImplementedError()