aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/framework/interfaces/face/face.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/grpcio/grpc/framework/interfaces/face/face.py')
-rw-r--r--src/python/grpcio/grpc/framework/interfaces/face/face.py610
1 files changed, 344 insertions, 266 deletions
diff --git a/src/python/grpcio/grpc/framework/interfaces/face/face.py b/src/python/grpcio/grpc/framework/interfaces/face/face.py
index 4826e7fff6..36ddca18c1 100644
--- a/src/python/grpcio/grpc/framework/interfaces/face/face.py
+++ b/src/python/grpcio/grpc/framework/interfaces/face/face.py
@@ -26,7 +26,6 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
"""Interfaces defining the Face layer of RPC Framework."""
import abc
@@ -45,33 +44,38 @@ from grpc.framework.foundation import stream # pylint: disable=unused-import
class NoSuchMethodError(Exception):
- """Raised by customer code to indicate an unrecognized method.
+ """Raised by customer code to indicate an unrecognized method.
Attributes:
group: The group of the unrecognized method.
name: The name of the unrecognized method.
"""
- def __init__(self, group, method):
- """Constructor.
+ def __init__(self, group, method):
+ """Constructor.
Args:
group: The group identifier of the unrecognized RPC name.
method: The method identifier of the unrecognized RPC name.
"""
- super(NoSuchMethodError, self).__init__()
- self.group = group
- self.method = method
+ super(NoSuchMethodError, self).__init__()
+ self.group = group
+ self.method = method
- def __repr__(self):
- return 'face.NoSuchMethodError(%s, %s)' % (self.group, self.method,)
+ def __repr__(self):
+ return 'face.NoSuchMethodError(%s, %s)' % (
+ self.group,
+ self.method,)
class Abortion(
- collections.namedtuple(
- 'Abortion',
- ('kind', 'initial_metadata', 'terminal_metadata', 'code', 'details',))):
- """A value describing RPC abortion.
+ collections.namedtuple('Abortion', (
+ 'kind',
+ 'initial_metadata',
+ 'terminal_metadata',
+ 'code',
+ 'details',))):
+ """A value describing RPC abortion.
Attributes:
kind: A Kind value identifying how the RPC failed.
@@ -85,21 +89,21 @@ class Abortion(
details value was received.
"""
- @enum.unique
- class Kind(enum.Enum):
- """Types of RPC abortion."""
+ @enum.unique
+ class Kind(enum.Enum):
+ """Types of RPC abortion."""
- CANCELLED = 'cancelled'
- EXPIRED = 'expired'
- LOCAL_SHUTDOWN = 'local shutdown'
- REMOTE_SHUTDOWN = 'remote shutdown'
- NETWORK_FAILURE = 'network failure'
- LOCAL_FAILURE = 'local failure'
- REMOTE_FAILURE = 'remote failure'
+ CANCELLED = 'cancelled'
+ EXPIRED = 'expired'
+ LOCAL_SHUTDOWN = 'local shutdown'
+ REMOTE_SHUTDOWN = 'remote shutdown'
+ NETWORK_FAILURE = 'network failure'
+ LOCAL_FAILURE = 'local failure'
+ REMOTE_FAILURE = 'remote failure'
class AbortionError(six.with_metaclass(abc.ABCMeta, Exception)):
- """Common super type for exceptions indicating RPC abortion.
+ """Common super type for exceptions indicating RPC abortion.
initial_metadata: The initial metadata from the other side of the RPC or
None if no initial metadata value was received.
@@ -111,100 +115,100 @@ class AbortionError(six.with_metaclass(abc.ABCMeta, Exception)):
details value was received.
"""
- def __init__(self, initial_metadata, terminal_metadata, code, details):
- super(AbortionError, self).__init__()
- self.initial_metadata = initial_metadata
- self.terminal_metadata = terminal_metadata
- self.code = code
- self.details = details
+ def __init__(self, initial_metadata, terminal_metadata, code, details):
+ super(AbortionError, self).__init__()
+ self.initial_metadata = initial_metadata
+ self.terminal_metadata = terminal_metadata
+ self.code = code
+ self.details = details
- def __str__(self):
- return '%s(code=%s, details="%s")' % (
- self.__class__.__name__, self.code, self.details)
+ def __str__(self):
+ return '%s(code=%s, details="%s")' % (self.__class__.__name__,
+ self.code, self.details)
class CancellationError(AbortionError):
- """Indicates that an RPC has been cancelled."""
+ """Indicates that an RPC has been cancelled."""
class ExpirationError(AbortionError):
- """Indicates that an RPC has expired ("timed out")."""
+ """Indicates that an RPC has expired ("timed out")."""
class LocalShutdownError(AbortionError):
- """Indicates that an RPC has terminated due to local shutdown of RPCs."""
+ """Indicates that an RPC has terminated due to local shutdown of RPCs."""
class RemoteShutdownError(AbortionError):
- """Indicates that an RPC has terminated due to remote shutdown of RPCs."""
+ """Indicates that an RPC has terminated due to remote shutdown of RPCs."""
class NetworkError(AbortionError):
- """Indicates that some error occurred on the network."""
+ """Indicates that some error occurred on the network."""
class LocalError(AbortionError):
- """Indicates that an RPC has terminated due to a local defect."""
+ """Indicates that an RPC has terminated due to a local defect."""
class RemoteError(AbortionError):
- """Indicates that an RPC has terminated due to a remote defect."""
+ """Indicates that an RPC has terminated due to a remote defect."""
class RpcContext(six.with_metaclass(abc.ABCMeta)):
- """Provides RPC-related information and action."""
+ """Provides RPC-related information and action."""
- @abc.abstractmethod
- def is_active(self):
- """Describes whether the RPC is active or has terminated."""
- raise NotImplementedError()
+ @abc.abstractmethod
+ def is_active(self):
+ """Describes whether the RPC is active or has terminated."""
+ raise NotImplementedError()
- @abc.abstractmethod
- def time_remaining(self):
- """Describes the length of allowed time remaining for the RPC.
+ @abc.abstractmethod
+ def time_remaining(self):
+ """Describes the length of allowed time remaining for the RPC.
Returns:
A nonnegative float indicating the length of allowed time in seconds
remaining for the RPC to complete before it is considered to have timed
out.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def add_abortion_callback(self, abortion_callback):
- """Registers a callback to be called if the RPC is aborted.
+ @abc.abstractmethod
+ def add_abortion_callback(self, abortion_callback):
+ """Registers a callback to be called if the RPC is aborted.
Args:
abortion_callback: A callable to be called and passed an Abortion value
in the event of RPC abortion.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def cancel(self):
- """Cancels the RPC.
+ @abc.abstractmethod
+ def cancel(self):
+ """Cancels the RPC.
Idempotent and has no effect if the RPC has already terminated.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def protocol_context(self):
- """Accesses a custom object specified by an implementation provider.
+ @abc.abstractmethod
+ def protocol_context(self):
+ """Accesses a custom object specified by an implementation provider.
Returns:
A value specified by the provider of a Face interface implementation
affording custom state and behavior.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
- """Invocation-side utility object for an RPC."""
+ """Invocation-side utility object for an RPC."""
- @abc.abstractmethod
- def initial_metadata(self):
- """Accesses the initial metadata from the service-side of the RPC.
+ @abc.abstractmethod
+ def initial_metadata(self):
+ """Accesses the initial metadata from the service-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the service-side of the RPC.
@@ -213,11 +217,11 @@ class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
The initial metadata object emitted by the service-side of the RPC, or
None if there was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def terminal_metadata(self):
- """Accesses the terminal metadata from the service-side of the RPC.
+ @abc.abstractmethod
+ def terminal_metadata(self):
+ """Accesses the terminal metadata from the service-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the service-side of the RPC.
@@ -226,11 +230,11 @@ class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
The terminal metadata object emitted by the service-side of the RPC, or
None if there was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def code(self):
- """Accesses the code emitted by the service-side of the RPC.
+ @abc.abstractmethod
+ def code(self):
+ """Accesses the code emitted by the service-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the service-side of the RPC.
@@ -239,11 +243,11 @@ class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
The code object emitted by the service-side of the RPC, or None if there
was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def details(self):
- """Accesses the details value emitted by the service-side of the RPC.
+ @abc.abstractmethod
+ def details(self):
+ """Accesses the details value emitted by the service-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the service-side of the RPC.
@@ -252,15 +256,15 @@ class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
The details value emitted by the service-side of the RPC, or None if there
was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
- """A context object passed to method implementations."""
+ """A context object passed to method implementations."""
- @abc.abstractmethod
- def invocation_metadata(self):
- """Accesses the metadata from the invocation-side of the RPC.
+ @abc.abstractmethod
+ def invocation_metadata(self):
+ """Accesses the metadata from the invocation-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the invocation-side of the RPC.
@@ -269,11 +273,11 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
The metadata object emitted by the invocation-side of the RPC, or None if
there was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def initial_metadata(self, initial_metadata):
- """Accepts the service-side initial metadata value of the RPC.
+ @abc.abstractmethod
+ def initial_metadata(self, initial_metadata):
+ """Accepts the service-side initial metadata value of the RPC.
This method need not be called by method implementations if they have no
service-side initial metadata to transmit.
@@ -282,11 +286,11 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
initial_metadata: The service-side initial metadata value of the RPC to
be transmitted to the invocation side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def terminal_metadata(self, terminal_metadata):
- """Accepts the service-side terminal metadata value of the RPC.
+ @abc.abstractmethod
+ def terminal_metadata(self, terminal_metadata):
+ """Accepts the service-side terminal metadata value of the RPC.
This method need not be called by method implementations if they have no
service-side terminal metadata to transmit.
@@ -295,11 +299,11 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
terminal_metadata: The service-side terminal metadata value of the RPC to
be transmitted to the invocation side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def code(self, code):
- """Accepts the service-side code of the RPC.
+ @abc.abstractmethod
+ def code(self, code):
+ """Accepts the service-side code of the RPC.
This method need not be called by method implementations if they have no
code to transmit.
@@ -308,11 +312,11 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
code: The code of the RPC to be transmitted to the invocation side of the
RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def details(self, details):
- """Accepts the service-side details of the RPC.
+ @abc.abstractmethod
+ def details(self, details):
+ """Accepts the service-side details of the RPC.
This method need not be called by method implementations if they have no
service-side details to transmit.
@@ -321,34 +325,34 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
details: The service-side details value of the RPC to be transmitted to
the invocation side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class ResponseReceiver(six.with_metaclass(abc.ABCMeta)):
- """Invocation-side object used to accept the output of an RPC."""
+ """Invocation-side object used to accept the output of an RPC."""
- @abc.abstractmethod
- def initial_metadata(self, initial_metadata):
- """Receives the initial metadata from the service-side of the RPC.
+ @abc.abstractmethod
+ def initial_metadata(self, initial_metadata):
+ """Receives the initial metadata from the service-side of the RPC.
Args:
initial_metadata: The initial metadata object emitted from the
service-side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def response(self, response):
- """Receives a response from the service-side of the RPC.
+ @abc.abstractmethod
+ def response(self, response):
+ """Receives a response from the service-side of the RPC.
Args:
response: A response object emitted from the service-side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def complete(self, terminal_metadata, code, details):
- """Receives the completion values emitted from the service-side of the RPC.
+ @abc.abstractmethod
+ def complete(self, terminal_metadata, code, details):
+ """Receives the completion values emitted from the service-side of the RPC.
Args:
terminal_metadata: The terminal metadata object emitted from the
@@ -356,17 +360,20 @@ class ResponseReceiver(six.with_metaclass(abc.ABCMeta)):
code: The code object emitted from the service-side of the RPC.
details: The details object emitted from the service-side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a unary-unary RPC in any call style."""
+ """Affords invoking a unary-unary RPC in any call style."""
- @abc.abstractmethod
- def __call__(
- self, request, timeout, metadata=None, with_call=False,
- protocol_options=None):
- """Synchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def __call__(self,
+ request,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Synchronously invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -385,11 +392,11 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Raises:
AbortionError: Indicating that the RPC was aborted.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def future(self, request, timeout, metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def future(self, request, timeout, metadata=None, protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -405,13 +412,17 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
response value of the RPC. In the event of RPC abortion, the returned
Future's exception value will be an AbortionError.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event(
- self, request, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event(self,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -427,15 +438,15 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Returns:
A Call for the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a unary-stream RPC in any call style."""
+ """Affords invoking a unary-stream RPC in any call style."""
- @abc.abstractmethod
- def __call__(self, request, timeout, metadata=None, protocol_options=None):
- """Invokes the underlying RPC.
+ @abc.abstractmethod
+ def __call__(self, request, timeout, metadata=None, protocol_options=None):
+ """Invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -450,13 +461,17 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
values. Drawing response values from the returned iterator may raise
AbortionError indicating abortion of the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event(
- self, request, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event(self,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -472,17 +487,20 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
Returns:
A Call object for the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a stream-unary RPC in any call style."""
+ """Affords invoking a stream-unary RPC in any call style."""
- @abc.abstractmethod
- def __call__(
- self, request_iterator, timeout, metadata=None,
- with_call=False, protocol_options=None):
- """Synchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def __call__(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Synchronously invokes the underlying RPC.
Args:
request_iterator: An iterator that yields request values for the RPC.
@@ -501,12 +519,15 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Raises:
AbortionError: Indicating that the RPC was aborted.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def future(
- self, request_iterator, timeout, metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def future(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
request_iterator: An iterator that yields request values for the RPC.
@@ -522,13 +543,16 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
response value of the RPC. In the event of RPC abortion, the returned
Future's exception value will be an AbortionError.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def event(
- self, receiver, abortion_callback, timeout, metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def event(self,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
receiver: A ResponseReceiver to be passed the response data of the RPC.
@@ -544,16 +568,19 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
A single object that is both a Call object for the RPC and a
stream.Consumer to which the request values of the RPC should be passed.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a stream-stream RPC in any call style."""
+ """Affords invoking a stream-stream RPC in any call style."""
- @abc.abstractmethod
- def __call__(
- self, request_iterator, timeout, metadata=None, protocol_options=None):
- """Invokes the underlying RPC.
+ @abc.abstractmethod
+ def __call__(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes the underlying RPC.
Args:
request_iterator: An iterator that yields request values for the RPC.
@@ -568,13 +595,16 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
values. Drawing response values from the returned iterator may raise
AbortionError indicating abortion of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def event(
- self, receiver, abortion_callback, timeout, metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def event(self,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
receiver: A ResponseReceiver to be passed the response data of the RPC.
@@ -590,11 +620,11 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
A single object that is both a Call object for the RPC and a
stream.Consumer to which the request values of the RPC should be passed.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class MethodImplementation(six.with_metaclass(abc.ABCMeta)):
- """A sum type that describes a method implementation.
+ """A sum type that describes a method implementation.
Attributes:
cardinality: A cardinality.Cardinality value.
@@ -639,11 +669,11 @@ class MethodImplementation(six.with_metaclass(abc.ABCMeta)):
class MultiMethodImplementation(six.with_metaclass(abc.ABCMeta)):
- """A general type able to service many methods."""
+ """A general type able to service many methods."""
- @abc.abstractmethod
- def service(self, group, method, response_consumer, context):
- """Services an RPC.
+ @abc.abstractmethod
+ def service(self, group, method, response_consumer, context):
+ """Services an RPC.
Args:
group: The group identifier of the RPC.
@@ -666,17 +696,22 @@ class MultiMethodImplementation(six.with_metaclass(abc.ABCMeta)):
NoSuchMethodError: If this MultiMethod does not recognize the given group
and name for the RPC and is not able to service the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class GenericStub(six.with_metaclass(abc.ABCMeta)):
- """Affords RPC invocation via generic methods."""
-
- @abc.abstractmethod
- def blocking_unary_unary(
- self, group, method, request, timeout, metadata=None,
- with_call=False, protocol_options=None):
- """Invokes a unary-request-unary-response method.
+ """Affords RPC invocation via generic methods."""
+
+ @abc.abstractmethod
+ def blocking_unary_unary(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Invokes a unary-request-unary-response method.
This method blocks until either returning the response value of the RPC
(in the event of RPC completion) or raising an exception (in the event of
@@ -700,13 +735,17 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Raises:
AbortionError: Indicating that the RPC was aborted.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future_unary_unary(
- self, group, method, request, timeout, metadata=None,
- protocol_options=None):
- """Invokes a unary-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future_unary_unary(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a unary-request-unary-response method.
Args:
group: The group identifier of the RPC.
@@ -723,13 +762,17 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
response value of the RPC. In the event of RPC abortion, the returned
Future's exception value will be an AbortionError.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def inline_unary_stream(
- self, group, method, request, timeout, metadata=None,
- protocol_options=None):
- """Invokes a unary-request-stream-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def inline_unary_stream(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a unary-request-stream-response method.
Args:
group: The group identifier of the RPC.
@@ -745,13 +788,18 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
values. Drawing response values from the returned iterator may raise
AbortionError indicating abortion of the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def blocking_stream_unary(
- self, group, method, request_iterator, timeout, metadata=None,
- with_call=False, protocol_options=None):
- """Invokes a stream-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def blocking_stream_unary(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Invokes a stream-request-unary-response method.
This method blocks until either returning the response value of the RPC
(in the event of RPC completion) or raising an exception (in the event of
@@ -775,13 +823,17 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Raises:
AbortionError: Indicating that the RPC was aborted.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future_stream_unary(
- self, group, method, request_iterator, timeout, metadata=None,
- protocol_options=None):
- """Invokes a stream-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future_stream_unary(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a stream-request-unary-response method.
Args:
group: The group identifier of the RPC.
@@ -798,13 +850,17 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
response value of the RPC. In the event of RPC abortion, the returned
Future's exception value will be an AbortionError.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def inline_stream_stream(
- self, group, method, request_iterator, timeout, metadata=None,
- protocol_options=None):
- """Invokes a stream-request-stream-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def inline_stream_stream(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a stream-request-stream-response method.
Args:
group: The group identifier of the RPC.
@@ -820,13 +876,19 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
values. Drawing response values from the returned iterator may raise
AbortionError indicating abortion of the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_unary_unary(
- self, group, method, request, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Event-driven invocation of a unary-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_unary_unary(self,
+ group,
+ method,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-unary-response method.
Args:
group: The group identifier of the RPC.
@@ -843,13 +905,19 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A Call for the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_unary_stream(
- self, group, method, request, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Event-driven invocation of a unary-request-stream-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_unary_stream(self,
+ group,
+ method,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-stream-response method.
Args:
group: The group identifier of the RPC.
@@ -866,13 +934,18 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A Call for the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_stream_unary(
- self, group, method, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Event-driven invocation of a unary-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_stream_unary(self,
+ group,
+ method,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-unary-response method.
Args:
group: The group identifier of the RPC.
@@ -889,13 +962,18 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
A pair of a Call object for the RPC and a stream.Consumer to which the
request values of the RPC should be passed.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_stream_stream(
- self, group, method, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Event-driven invocation of a unary-request-stream-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_stream_stream(self,
+ group,
+ method,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-stream-response method.
Args:
group: The group identifier of the RPC.
@@ -912,11 +990,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
A pair of a Call object for the RPC and a stream.Consumer to which the
request values of the RPC should be passed.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def unary_unary(self, group, method):
- """Creates a UnaryUnaryMultiCallable for a unary-unary method.
+ @abc.abstractmethod
+ def unary_unary(self, group, method):
+ """Creates a UnaryUnaryMultiCallable for a unary-unary method.
Args:
group: The group identifier of the RPC.
@@ -925,11 +1003,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A UnaryUnaryMultiCallable value for the named unary-unary method.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def unary_stream(self, group, method):
- """Creates a UnaryStreamMultiCallable for a unary-stream method.
+ @abc.abstractmethod
+ def unary_stream(self, group, method):
+ """Creates a UnaryStreamMultiCallable for a unary-stream method.
Args:
group: The group identifier of the RPC.
@@ -938,11 +1016,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A UnaryStreamMultiCallable value for the name unary-stream method.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def stream_unary(self, group, method):
- """Creates a StreamUnaryMultiCallable for a stream-unary method.
+ @abc.abstractmethod
+ def stream_unary(self, group, method):
+ """Creates a StreamUnaryMultiCallable for a stream-unary method.
Args:
group: The group identifier of the RPC.
@@ -951,11 +1029,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A StreamUnaryMultiCallable value for the named stream-unary method.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def stream_stream(self, group, method):
- """Creates a StreamStreamMultiCallable for a stream-stream method.
+ @abc.abstractmethod
+ def stream_stream(self, group, method):
+ """Creates a StreamStreamMultiCallable for a stream-stream method.
Args:
group: The group identifier of the RPC.
@@ -964,11 +1042,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A StreamStreamMultiCallable value for the named stream-stream method.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class DynamicStub(six.with_metaclass(abc.ABCMeta)):
- """Affords RPC invocation via attributes corresponding to afforded methods.
+ """Affords RPC invocation via attributes corresponding to afforded methods.
Instances of this type may be scoped to a single group so that attribute
access is unambiguous.