Package google :: Package protobuf :: Module service_reflection :: Class _ServiceBuilder
[hide private]
[frames] | no frames]

Class _ServiceBuilder

source code

object --+
         |
        _ServiceBuilder

This class constructs a protocol service class using a service descriptor.

Given a service descriptor, this class constructs a class that represents the specified service descriptor. One service builder instance constructs exactly one service class. That means all instances of that class share the same builder.

Instance Methods [hide private]
 
__init__(self, service_descriptor)
Initializes an instance of the service class builder.
source code
 
BuildService(self, cls)
Constructs the service class.
source code
 
_CallMethod(self, srvc, method_descriptor, rpc_controller, request, callback)
Calls the method described by a given method descriptor.
source code
 
_GetRequestClass(self, method_descriptor)
Returns the class of the request protocol message.
source code
 
_GetResponseClass(self, method_descriptor)
Returns the class of the response protocol message.
source code
 
_GenerateNonImplementedMethod(self, method)
Generates and returns a method that can be set for a service methods.
source code
 
_NonImplementedMethod(self, method_name, rpc_controller, callback)
The body of all methods in the generated service class.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, service_descriptor)
(Constructor)

source code 
Initializes an instance of the service class builder.

Args:
  service_descriptor: ServiceDescriptor to use when constructing the
    service class.

Overrides: object.__init__

BuildService(self, cls)

source code 
Constructs the service class.

Args:
  cls: The class that will be constructed.

_CallMethod(self, srvc, method_descriptor, rpc_controller, request, callback)

source code 
Calls the method described by a given method descriptor.

Args:
  srvc: Instance of the service for which this method is called.
  method_descriptor: Descriptor that represent the method to call.
  rpc_controller: RPC controller to use for this method's execution.
  request: Request protocol message.
  callback: A callback to invoke after the method has completed.

_GetRequestClass(self, method_descriptor)

source code 
Returns the class of the request protocol message.

Args:
  method_descriptor: Descriptor of the method for which to return the
    request protocol message class.

Returns:
  A class that represents the input protocol message of the specified
  method.

_GetResponseClass(self, method_descriptor)

source code 
Returns the class of the response protocol message.

Args:
  method_descriptor: Descriptor of the method for which to return the
    response protocol message class.

Returns:
  A class that represents the output protocol message of the specified
  method.

_GenerateNonImplementedMethod(self, method)

source code 
Generates and returns a method that can be set for a service methods.

Args:
  method: Descriptor of the service method for which a method is to be
    generated.

Returns:
  A method that can be added to the service class.

_NonImplementedMethod(self, method_name, rpc_controller, callback)

source code 
The body of all methods in the generated service class.

Args:
  method_name: Name of the method being executed.
  rpc_controller: RPC controller used to execute this method.
  callback: A callback which will be invoked when the method finishes.