thriftworker Package
thriftworker Package
Process incoming request and return it’s result.
app Module
ThriftWorker.
Distribute thrift requests between workers.
-
class thriftworker.app.ThriftWorker(loop=None, protocol_factory=None, port_range=None, pool_size=None, shutdown_timeout=None)[source]
Bases: thriftworker.utils.mixin.SubclassMixin
Store global application state. Also acts as factory for whole
application.
-
Acceptor[source]
-
Acceptors[source]
-
Hub[source]
Create bounded Hub class.
-
Listener[source]
Create bounded Listener class.
-
Listeners[source]
Create bounded Listeners class.
-
Services[source]
Create bounded Processor class.
-
Worker[source]
-
acceptor_cls = 'thriftworker.transports.framed:FramedAcceptor'
-
acceptors[source]
Create pool of acceptors.
-
classmethod default()[source]
Return default application instance.
-
hub[source]
Instance of bounded LoopContainer.
-
static instance()[source]
Return global instance.
-
listeners[source]
Create pool of listeners.
-
loop[source]
Create event loop. Should be running in separate thread.
-
pool_size[source]
Return default pool size.
-
port_range[source]
Return range from which we allowed to allocate ports.
-
protocol_factory[source]
Specify which protocol should be used.
-
services[source]
Create global request processor instance.
-
worker[source]
Create some worker routine.
-
worker_cls[source]
constants Module
All constants for this package.
exceptions Module
All exceptions for this package.
-
exception thriftworker.exceptions.AllocationError[source]
Bases: exceptions.Exception
Raised if we can’t bind to any address from pool.
-
exception thriftworker.exceptions.BindError[source]
Bases: exceptions.Exception
Error on socket binding.
hub Module
services Module
Store processor and protocol for each service.
-
class thriftworker.services.Services[source]
Bases: object
Process new requests and return response. Store processor
for each service.
-
class Service
Bases: tuple
Holder of service processor and protocol factory.
-
processor
Alias for field number 0
-
proto_factory
Alias for field number 1
-
Services.app = None
-
Services.create_processor(service_name)[source]
Create function that will process incoming request and return
payload that we should return.
Parameters: | service_name – name of served service |
-
Services.register(service_name, processor, proto_factory=None)[source]
Register new processor for given service.
state Module
Handle global package state.
-
thriftworker.state.get_current_app()[source]
-
thriftworker.state.set_current_app(app)[source]