grpc.framework.interfaces.face package¶
Submodules¶
grpc.framework.interfaces.face.face module¶
Interfaces defining the Face layer of RPC Framework.
-
class
grpc.framework.interfaces.face.face.
Abortion
[source]¶ Bases:
grpc.framework.interfaces.face.face.Abortion
A value describing RPC abortion.
-
kind
¶ A Kind value identifying how the RPC failed.
-
initial_metadata
¶ The initial metadata from the other side of the RPC or None if no initial metadata value was received.
-
terminal_metadata
¶ The terminal metadata from the other side of the RPC or None if no terminal metadata value was received.
-
code
¶ The code value from the other side of the RPC or None if no code value was received.
-
details
¶ The details value from the other side of the RPC or None if no details value was received.
-
-
exception
grpc.framework.interfaces.face.face.
AbortionError
(initial_metadata, terminal_metadata, code, details)[source]¶ Bases:
Exception
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.
- terminal_metadata: The terminal metadata from the other side of the RPC or
- None if no terminal metadata value was received.
- code: The code value from the other side of the RPC or None if no code value
- was received.
- details: The details value from the other side of the RPC or None if no
- details value was received.
-
class
grpc.framework.interfaces.face.face.
Call
[source]¶ Bases:
grpc.framework.interfaces.face.face.RpcContext
Invocation-side utility object for an RPC.
-
code
()[source]¶ 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.
Returns: - The code object emitted by the service-side of the RPC, or None if there
- was no such value.
-
details
()[source]¶ 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.
Returns: - The details value emitted by the service-side of the RPC, or None if there
- was no such value.
-
initial_metadata
()[source]¶ 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.
Returns: - The initial metadata object emitted by the service-side of the RPC, or
- None if there was no such value.
-
terminal_metadata
()[source]¶ 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.
Returns: - The terminal metadata object emitted by the service-side of the RPC, or
- None if there was no such value.
-
-
exception
grpc.framework.interfaces.face.face.
CancellationError
(initial_metadata, terminal_metadata, code, details)[source]¶ Bases:
grpc.framework.interfaces.face.face.AbortionError
Indicates that an RPC has been cancelled.
-
class
grpc.framework.interfaces.face.face.
DynamicStub
[source]¶ Bases:
object
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.
Instances of this type respond to attribute access as follows: if the requested attribute is the name of a unary-unary method, the value of the attribute will be a UnaryUnaryMultiCallable with which to invoke an RPC; if the requested attribute is the name of a unary-stream method, the value of the attribute will be a UnaryStreamMultiCallable with which to invoke an RPC; if the requested attribute is the name of a stream-unary method, the value of the attribute will be a StreamUnaryMultiCallable with which to invoke an RPC; and if the requested attribute is the name of a stream-stream method, the value of the attribute will be a StreamStreamMultiCallable with which to invoke an RPC.
-
exception
grpc.framework.interfaces.face.face.
ExpirationError
(initial_metadata, terminal_metadata, code, details)[source]¶ Bases:
grpc.framework.interfaces.face.face.AbortionError
Indicates that an RPC has expired (“timed out”).
-
class
grpc.framework.interfaces.face.face.
GenericStub
[source]¶ Bases:
object
Affords RPC invocation via generic methods.
-
blocking_stream_unary
(group, method, request_iterator, timeout, metadata=None, with_call=False, protocol_options=None)[source]¶ 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 RPC abortion).
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- request_iterator – An iterator that yields request values for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- with_call – Whether or not to include return a Call for the RPC in addition to the response.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - The response value for the RPC, and a Call for the RPC if with_call was
set to True at invocation.
Raises: AbortionError
– Indicating that the RPC was aborted.
-
blocking_unary_unary
(group, method, request, timeout, metadata=None, with_call=False, protocol_options=None)[source]¶ 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 RPC abortion).
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- request – The request value for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- with_call – Whether or not to include return a Call for the RPC in addition to the response.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - The response value for the RPC, and a Call for the RPC if with_call was
set to True at invocation.
Raises: AbortionError
– Indicating that the RPC was aborted.
-
event_stream_stream
(group, method, receiver, abortion_callback, timeout, metadata=None, protocol_options=None)[source]¶ Event-driven invocation of a unary-request-stream-response method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- receiver – A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback – A callback to be called and passed an Abortion value in the event of RPC abortion.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - A pair of a Call object for the RPC and a stream.Consumer to which the
request values of the RPC should be passed.
-
event_stream_unary
(group, method, receiver, abortion_callback, timeout, metadata=None, protocol_options=None)[source]¶ Event-driven invocation of a unary-request-unary-response method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- receiver – A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback – A callback to be called and passed an Abortion value in the event of RPC abortion.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - A pair of a Call object for the RPC and a stream.Consumer to which the
request values of the RPC should be passed.
-
event_unary_stream
(group, method, request, receiver, abortion_callback, timeout, metadata=None, protocol_options=None)[source]¶ Event-driven invocation of a unary-request-stream-response method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- request – The request value for the RPC.
- receiver – A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback – A callback to be called and passed an Abortion value in the event of RPC abortion.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: A Call for the RPC.
-
event_unary_unary
(group, method, request, receiver, abortion_callback, timeout, metadata=None, protocol_options=None)[source]¶ Event-driven invocation of a unary-request-unary-response method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- request – The request value for the RPC.
- receiver – A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback – A callback to be called and passed an Abortion value in the event of RPC abortion.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: A Call for the RPC.
-
future_stream_unary
(group, method, request_iterator, timeout, metadata=None, protocol_options=None)[source]¶ Invokes a stream-request-unary-response method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- request_iterator – An iterator that yields request values for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - An object that is both a Call for the RPC and a future.Future. In the
event of RPC completion, the return Future’s result value will be the response value of the RPC. In the event of RPC abortion, the returned Future’s exception value will be an AbortionError.
-
future_unary_unary
(group, method, request, timeout, metadata=None, protocol_options=None)[source]¶ Invokes a unary-request-unary-response method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- request – The request value for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - An object that is both a Call for the RPC and a future.Future. In the
event of RPC completion, the return Future’s result value will be the response value of the RPC. In the event of RPC abortion, the returned Future’s exception value will be an AbortionError.
-
inline_stream_stream
(group, method, request_iterator, timeout, metadata=None, protocol_options=None)[source]¶ Invokes a stream-request-stream-response method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- request_iterator – An iterator that yields request values for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - An object that is both a Call for the RPC and an iterator of response
values. Drawing response values from the returned iterator may raise AbortionError indicating abortion of the RPC.
-
inline_unary_stream
(group, method, request, timeout, metadata=None, protocol_options=None)[source]¶ Invokes a unary-request-stream-response method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- request – The request value for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - An object that is both a Call for the RPC and an iterator of response
values. Drawing response values from the returned iterator may raise AbortionError indicating abortion of the RPC.
-
stream_stream
(group, method)[source]¶ Creates a StreamStreamMultiCallable for a stream-stream method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
Returns: A StreamStreamMultiCallable value for the named stream-stream method.
-
stream_unary
(group, method)[source]¶ Creates a StreamUnaryMultiCallable for a stream-unary method.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
Returns: A StreamUnaryMultiCallable value for the named stream-unary method.
-
-
exception
grpc.framework.interfaces.face.face.
LocalError
(initial_metadata, terminal_metadata, code, details)[source]¶ Bases:
grpc.framework.interfaces.face.face.AbortionError
Indicates that an RPC has terminated due to a local defect.
-
exception
grpc.framework.interfaces.face.face.
LocalShutdownError
(initial_metadata, terminal_metadata, code, details)[source]¶ Bases:
grpc.framework.interfaces.face.face.AbortionError
Indicates that an RPC has terminated due to local shutdown of RPCs.
-
class
grpc.framework.interfaces.face.face.
MethodImplementation
[source]¶ Bases:
object
A sum type that describes a method implementation.
-
cardinality
¶ A cardinality.Cardinality value.
-
style
¶ A style.Service value.
-
unary_unary_inline
¶ The implementation of the method as a callable value that takes a request value and a ServicerContext object and returns a response value. Only non-None if cardinality is cardinality.Cardinality.UNARY_UNARY and style is style.Service.INLINE.
-
unary_stream_inline
¶ The implementation of the method as a callable value that takes a request value and a ServicerContext object and returns an iterator of response values. Only non-None if cardinality is cardinality.Cardinality.UNARY_STREAM and style is style.Service.INLINE.
-
stream_unary_inline
¶ The implementation of the method as a callable value that takes an iterator of request values and a ServicerContext object and returns a response value. Only non-None if cardinality is cardinality.Cardinality.STREAM_UNARY and style is style.Service.INLINE.
-
stream_stream_inline
¶ The implementation of the method as a callable value that takes an iterator of request values and a ServicerContext object and returns an iterator of response values. Only non-None if cardinality is cardinality.Cardinality.STREAM_STREAM and style is style.Service.INLINE.
-
unary_unary_event
¶ The implementation of the method as a callable value that takes a request value, a response callback to which to pass the response value of the RPC, and a ServicerContext. Only non-None if cardinality is cardinality.Cardinality.UNARY_UNARY and style is style.Service.EVENT.
-
unary_stream_event
¶ The implementation of the method as a callable value that takes a request value, a stream.Consumer to which to pass the response values of the RPC, and a ServicerContext. Only non-None if cardinality is cardinality.Cardinality.UNARY_STREAM and style is style.Service.EVENT.
-
stream_unary_event
¶ The implementation of the method as a callable value that takes a response callback to which to pass the response value of the RPC and a ServicerContext and returns a stream.Consumer to which the request values of the RPC should be passed. Only non-None if cardinality is cardinality.Cardinality.STREAM_UNARY and style is style.Service.EVENT.
-
stream_stream_event
¶ The implementation of the method as a callable value that takes a stream.Consumer to which to pass the response values of the RPC and a ServicerContext and returns a stream.Consumer to which the request values of the RPC should be passed. Only non-None if cardinality is cardinality.Cardinality.STREAM_STREAM and style is style.Service.EVENT.
-
-
class
grpc.framework.interfaces.face.face.
MultiMethodImplementation
[source]¶ Bases:
object
A general type able to service many methods.
-
service
(group, method, response_consumer, context)[source]¶ Services an RPC.
Parameters: - group – The group identifier of the RPC.
- method – The method identifier of the RPC.
- response_consumer – A stream.Consumer to be called to accept the response values of the RPC.
- context – a ServicerContext object.
Returns: - A stream.Consumer with which to accept the request values of the RPC. The
consumer returned from this method may or may not be invoked to completion: in the case of RPC abortion, RPC Framework will simply stop passing values to this object. Implementations must not assume that this object will be called to completion of the request stream or even called at all.
Raises: abandonment.Abandoned
– May or may not be raised when the RPC has been aborted.NoSuchMethodError
– If this MultiMethod does not recognize the given group and name for the RPC and is not able to service the RPC.
-
-
exception
grpc.framework.interfaces.face.face.
NetworkError
(initial_metadata, terminal_metadata, code, details)[source]¶ Bases:
grpc.framework.interfaces.face.face.AbortionError
Indicates that some error occurred on the network.
-
exception
grpc.framework.interfaces.face.face.
NoSuchMethodError
(group, method)[source]¶ Bases:
Exception
Raised by customer code to indicate an unrecognized method.
-
group
¶ The group of the unrecognized method.
-
name
¶ The name of the unrecognized method.
-
-
exception
grpc.framework.interfaces.face.face.
RemoteError
(initial_metadata, terminal_metadata, code, details)[source]¶ Bases:
grpc.framework.interfaces.face.face.AbortionError
Indicates that an RPC has terminated due to a remote defect.
-
exception
grpc.framework.interfaces.face.face.
RemoteShutdownError
(initial_metadata, terminal_metadata, code, details)[source]¶ Bases:
grpc.framework.interfaces.face.face.AbortionError
Indicates that an RPC has terminated due to remote shutdown of RPCs.
-
class
grpc.framework.interfaces.face.face.
ResponseReceiver
[source]¶ Bases:
object
Invocation-side object used to accept the output of an RPC.
-
complete
(terminal_metadata, code, details)[source]¶ Receives the completion values emitted from the service-side of the RPC.
Parameters: - terminal_metadata – The terminal metadata object emitted from the service-side of the RPC.
- code – The code object emitted from the service-side of the RPC.
- details – The details object emitted from the service-side of the RPC.
-
-
class
grpc.framework.interfaces.face.face.
RpcContext
[source]¶ Bases:
object
Provides RPC-related information and action.
-
add_abortion_callback
(abortion_callback)[source]¶ Registers a callback to be called if the RPC is aborted.
Parameters: abortion_callback – A callable to be called and passed an Abortion value in the event of RPC abortion.
-
-
class
grpc.framework.interfaces.face.face.
ServicerContext
[source]¶ Bases:
grpc.framework.interfaces.face.face.RpcContext
A context object passed to method implementations.
-
code
(code)[source]¶ Accepts the service-side code of the RPC.
This method need not be called by method implementations if they have no code to transmit.
Parameters: code – The code of the RPC to be transmitted to the invocation side of the RPC.
-
details
(details)[source]¶ 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.
Parameters: details – The service-side details value of the RPC to be transmitted to the invocation side of the RPC.
-
initial_metadata
(initial_metadata)[source]¶ 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.
Parameters: initial_metadata – The service-side initial metadata value of the RPC to be transmitted to the invocation side of the RPC.
-
invocation_metadata
()[source]¶ 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.
Returns: - The metadata object emitted by the invocation-side of the RPC, or None if
- there was no such value.
-
terminal_metadata
(terminal_metadata)[source]¶ 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.
Parameters: terminal_metadata – The service-side terminal metadata value of the RPC to be transmitted to the invocation side of the RPC.
-
-
class
grpc.framework.interfaces.face.face.
StreamStreamMultiCallable
[source]¶ Bases:
object
Affords invoking a stream-stream RPC in any call style.
-
__call__
(request_iterator, timeout, metadata=None, protocol_options=None)[source]¶ Invokes the underlying RPC.
Parameters: - request_iterator – An iterator that yields request values for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - An object that is both a Call for the RPC and an iterator of response
values. Drawing response values from the returned iterator may raise AbortionError indicating abortion of the RPC.
-
event
(receiver, abortion_callback, timeout, metadata=None, protocol_options=None)[source]¶ Asynchronously invokes the underlying RPC.
Parameters: - receiver – A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback – A callback to be called and passed an Abortion value in the event of RPC abortion.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - 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.
-
-
class
grpc.framework.interfaces.face.face.
StreamUnaryMultiCallable
[source]¶ Bases:
object
Affords invoking a stream-unary RPC in any call style.
-
__call__
(request_iterator, timeout, metadata=None, with_call=False, protocol_options=None)[source]¶ Synchronously invokes the underlying RPC.
Parameters: - request_iterator – An iterator that yields request values for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- with_call – Whether or not to include return a Call for the RPC in addition to the response.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - The response value for the RPC, and a Call for the RPC if with_call was
set to True at invocation.
Raises: AbortionError
– Indicating that the RPC was aborted.
-
event
(receiver, abortion_callback, timeout, metadata=None, protocol_options=None)[source]¶ Asynchronously invokes the underlying RPC.
Parameters: - receiver – A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback – A callback to be called and passed an Abortion value in the event of RPC abortion.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - 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.
-
future
(request_iterator, timeout, metadata=None, protocol_options=None)[source]¶ Asynchronously invokes the underlying RPC.
Parameters: - request_iterator – An iterator that yields request values for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - An object that is both a Call for the RPC and a future.Future. In the
event of RPC completion, the return Future’s result value will be the response value of the RPC. In the event of RPC abortion, the returned Future’s exception value will be an AbortionError.
-
-
class
grpc.framework.interfaces.face.face.
UnaryStreamMultiCallable
[source]¶ Bases:
object
Affords invoking a unary-stream RPC in any call style.
-
__call__
(request, timeout, metadata=None, protocol_options=None)[source]¶ Invokes the underlying RPC.
Parameters: - request – The request value for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - An object that is both a Call for the RPC and an iterator of response
values. Drawing response values from the returned iterator may raise AbortionError indicating abortion of the RPC.
-
event
(request, receiver, abortion_callback, timeout, metadata=None, protocol_options=None)[source]¶ Asynchronously invokes the underlying RPC.
Parameters: - request – The request value for the RPC.
- receiver – A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback – A callback to be called and passed an Abortion value in the event of RPC abortion.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: A Call object for the RPC.
-
-
class
grpc.framework.interfaces.face.face.
UnaryUnaryMultiCallable
[source]¶ Bases:
object
Affords invoking a unary-unary RPC in any call style.
-
__call__
(request, timeout, metadata=None, with_call=False, protocol_options=None)[source]¶ Synchronously invokes the underlying RPC.
Parameters: - request – The request value for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- with_call – Whether or not to include return a Call for the RPC in addition to the response.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - The response value for the RPC, and a Call for the RPC if with_call was
set to True at invocation.
Raises: AbortionError
– Indicating that the RPC was aborted.
-
event
(request, receiver, abortion_callback, timeout, metadata=None, protocol_options=None)[source]¶ Asynchronously invokes the underlying RPC.
Parameters: - request – The request value for the RPC.
- receiver – A ResponseReceiver to be passed the response data of the RPC.
- abortion_callback – A callback to be called and passed an Abortion value in the event of RPC abortion.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: A Call for the RPC.
-
future
(request, timeout, metadata=None, protocol_options=None)[source]¶ Asynchronously invokes the underlying RPC.
Parameters: - request – The request value for the RPC.
- timeout – A duration of time in seconds to allow for the RPC.
- metadata – A metadata value to be passed to the service-side of the RPC.
- protocol_options – A value specified by the provider of a Face interface implementation affording custom state and behavior.
Returns: - An object that is both a Call for the RPC and a future.Future. In the
event of RPC completion, the return Future’s result value will be the response value of the RPC. In the event of RPC abortion, the returned Future’s exception value will be an AbortionError.
-
grpc.framework.interfaces.face.utilities module¶
Utilities for RPC Framework’s Face interface.
-
grpc.framework.interfaces.face.utilities.
stream_stream_event
(behavior)[source]¶ Creates an face.MethodImplementation for the given behavior.
Parameters: behavior – The implementation of a stream-stream RPC method as a callable value that takes a stream.Consumer to which to pass the response values of the RPC and an face.ServicerContext and returns a stream.Consumer to which the request values of the RPC should be passed. Returns: An face.MethodImplementation derived from the given behavior.
-
grpc.framework.interfaces.face.utilities.
stream_stream_inline
(behavior)[source]¶ Creates an face.MethodImplementation for the given behavior.
Parameters: behavior – The implementation of a stream-stream RPC method as a callable value that takes an iterator of request values and an face.ServicerContext object and returns an iterator of response values. Returns: An face.MethodImplementation derived from the given behavior.
-
grpc.framework.interfaces.face.utilities.
stream_unary_event
(behavior)[source]¶ Creates an face.MethodImplementation for the given behavior.
Parameters: behavior – The implementation of a stream-unary RPC method as a callable value that takes a response callback to which to pass the response value of the RPC and an face.ServicerContext and returns a stream.Consumer to which the request values of the RPC should be passed. Returns: An face.MethodImplementation derived from the given behavior.
-
grpc.framework.interfaces.face.utilities.
stream_unary_inline
(behavior)[source]¶ Creates an face.MethodImplementation for the given behavior.
Parameters: behavior – The implementation of a stream-unary RPC method as a callable value that takes an iterator of request values and an face.ServicerContext object and returns a response value. Returns: An face.MethodImplementation derived from the given behavior.
-
grpc.framework.interfaces.face.utilities.
unary_stream_event
(behavior)[source]¶ Creates an face.MethodImplementation for the given behavior.
Parameters: behavior – The implementation of a unary-stream RPC method as a callable value that takes a request value, a stream.Consumer to which to pass the the response values of the RPC, and an face.ServicerContext. Returns: An face.MethodImplementation derived from the given behavior.
-
grpc.framework.interfaces.face.utilities.
unary_stream_inline
(behavior)[source]¶ Creates an face.MethodImplementation for the given behavior.
Parameters: behavior – The implementation of a unary-stream RPC method as a callable value that takes a request value and an face.ServicerContext object and returns an iterator of response values. Returns: An face.MethodImplementation derived from the given behavior.
-
grpc.framework.interfaces.face.utilities.
unary_unary_event
(behavior)[source]¶ Creates an face.MethodImplementation for the given behavior.
Parameters: behavior – The implementation of a unary-unary RPC method as a callable value that takes a request value, a response callback to which to pass the response value of the RPC, and an face.ServicerContext. Returns: An face.MethodImplementation derived from the given behavior.
-
grpc.framework.interfaces.face.utilities.
unary_unary_inline
(behavior)[source]¶ Creates an face.MethodImplementation for the given behavior.
Parameters: behavior – The implementation of a unary-unary RPC method as a callable value that takes a request value and an face.ServicerContext object and returns a response value. Returns: An face.MethodImplementation derived from the given behavior.