Public Member Functions | List of all members
google.protobuf.service.Service Class Reference
Inheritance diagram for google.protobuf.service.Service:
Inheritance graph
[legend]

Public Member Functions

def CallMethod (self, method_descriptor, rpc_controller, request, done)
 
def CallMethod (self, method_descriptor, rpc_controller, request, done)
 
def GetDescriptor ()
 
def GetDescriptor ()
 
def GetRequestClass (self, method_descriptor)
 
def GetRequestClass (self, method_descriptor)
 
def GetResponseClass (self, method_descriptor)
 
def GetResponseClass (self, method_descriptor)
 

Detailed Description

Abstract base interface for protocol-buffer-based RPC services.

Services themselves are abstract classes (implemented either by servers or as
stubs), but they subclass this base interface. The methods of this
interface can be used to call the methods of the service without knowing
its exact type at compile time (analogous to the Message interface).

Definition at line 51 of file third_party/bloaty/third_party/protobuf/python/google/protobuf/service.py.

Member Function Documentation

◆ CallMethod() [1/2]

def google.protobuf.service.Service.CallMethod (   self,
  method_descriptor,
  rpc_controller,
  request,
  done 
)
Calls a method of the service specified by method_descriptor.

If "done" is None then the call is blocking and the response
message will be returned directly.  Otherwise the call is asynchronous
and "done" will later be called with the response value.

In the blocking case, RpcException will be raised on error.

Preconditions:
* method_descriptor.service == GetDescriptor
* request is of the exact same classes as returned by
  GetRequestClass(method).
* After the call has started, the request must not be modified.
* "rpc_controller" is of the correct type for the RPC implementation being
  used by this Service.  For stubs, the "correct type" depends on the
  RpcChannel which the stub is using.

Postconditions:
* "done" will be called when the method is complete.  This may be
  before CallMethod() returns or it may be at some point in the future.
* If the RPC failed, the response value passed to "done" will be None.
  Further details about the failure can be found by querying the
  RpcController.

Definition at line 65 of file third_party/bloaty/third_party/protobuf/python/google/protobuf/service.py.

◆ CallMethod() [2/2]

def google.protobuf.service.Service.CallMethod (   self,
  method_descriptor,
  rpc_controller,
  request,
  done 
)
Calls a method of the service specified by method_descriptor.

If "done" is None then the call is blocking and the response
message will be returned directly.  Otherwise the call is asynchronous
and "done" will later be called with the response value.

In the blocking case, RpcException will be raised on error.

Preconditions:

* method_descriptor.service == GetDescriptor
* request is of the exact same classes as returned by
  GetRequestClass(method).
* After the call has started, the request must not be modified.
* "rpc_controller" is of the correct type for the RPC implementation being
  used by this Service.  For stubs, the "correct type" depends on the
  RpcChannel which the stub is using.

Postconditions:

* "done" will be called when the method is complete.  This may be
  before CallMethod() returns or it may be at some point in the future.
* If the RPC failed, the response value passed to "done" will be None.
  Further details about the failure can be found by querying the
  RpcController.

Definition at line 65 of file third_party/protobuf/python/google/protobuf/service.py.

◆ GetDescriptor() [1/2]

def google.protobuf.service.Service.GetDescriptor ( )
Retrieves this service's descriptor.

Definition at line 61 of file third_party/bloaty/third_party/protobuf/python/google/protobuf/service.py.

◆ GetDescriptor() [2/2]

def google.protobuf.service.Service.GetDescriptor ( )
Retrieves this service's descriptor.

Definition at line 61 of file third_party/protobuf/python/google/protobuf/service.py.

◆ GetRequestClass() [1/2]

def google.protobuf.service.Service.GetRequestClass (   self,
  method_descriptor 
)
Returns the class of the request message for the specified method.

CallMethod() requires that the request is of a particular subclass of
Message. GetRequestClass() gets the default instance of this required
type.

Example:
  method = service.GetDescriptor().FindMethodByName("Foo")
  request = stub.GetRequestClass(method)()
  request.ParseFromString(input)
  service.CallMethod(method, request, callback)

Definition at line 93 of file third_party/bloaty/third_party/protobuf/python/google/protobuf/service.py.

◆ GetRequestClass() [2/2]

def google.protobuf.service.Service.GetRequestClass (   self,
  method_descriptor 
)
Returns the class of the request message for the specified method.

CallMethod() requires that the request is of a particular subclass of
Message. GetRequestClass() gets the default instance of this required
type.

Example:
  method = service.GetDescriptor().FindMethodByName("Foo")
  request = stub.GetRequestClass(method)()
  request.ParseFromString(input)
  service.CallMethod(method, request, callback)

Definition at line 95 of file third_party/protobuf/python/google/protobuf/service.py.

◆ GetResponseClass() [1/2]

def google.protobuf.service.Service.GetResponseClass (   self,
  method_descriptor 
)
Returns the class of the response message for the specified method.

This method isn't really needed, as the RpcChannel's CallMethod constructs
the response protocol message. It's provided anyway in case it is useful
for the caller to know the response type in advance.

Definition at line 108 of file third_party/bloaty/third_party/protobuf/python/google/protobuf/service.py.

◆ GetResponseClass() [2/2]

def google.protobuf.service.Service.GetResponseClass (   self,
  method_descriptor 
)
Returns the class of the response message for the specified method.

This method isn't really needed, as the RpcChannel's CallMethod constructs
the response protocol message. It's provided anyway in case it is useful
for the caller to know the response type in advance.

Definition at line 110 of file third_party/protobuf/python/google/protobuf/service.py.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:28