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

Class _ServiceStubBuilder

source code

object --+
         |
        _ServiceStubBuilder

Constructs a protocol service stub class using a service descriptor.

Given a service descriptor, this class constructs a suitable stub class. A stub is just a type-safe wrapper around an RpcChannel which emulates a local implementation of the service.

One service stub builder instance constructs exactly one class. It means all instances of that class share the same service stub builder.

Instance Methods [hide private]
 
__init__(self, service_descriptor)
Initializes an instance of the service stub class builder.
source code
 
BuildServiceStub(self, cls)
Constructs the stub class.
source code
 
_GenerateStubMethod(self, method) source code
 
_StubMethod(self, stub, method_descriptor, rpc_controller, request, callback)
The body of all service methods in the generated stub 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 stub class builder.

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

Overrides: object.__init__

BuildServiceStub(self, cls)

source code 
Constructs the stub class.

Args:
  cls: The class that will be constructed.

_StubMethod(self, stub, method_descriptor, rpc_controller, request, callback)

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

Args:
  stub: Stub instance.
  method_descriptor: Descriptor of the invoked method.
  rpc_controller: Rpc controller to execute the method.
  request: Request protocol message.
  callback: A callback to execute when the method finishes.
Returns:
  Response message (in case of blocking call).