本文整理汇总了Python中thrift.protocol.TBinaryProtocol.TBinaryProtocolFactory方法的典型用法代码示例。如果您正苦于以下问题:Python TBinaryProtocol.TBinaryProtocolFactory方法的具体用法?Python TBinaryProtocol.TBinaryProtocolFactory怎么用?Python TBinaryProtocol.TBinaryProtocolFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thrift.protocol.TBinaryProtocol
的用法示例。
在下文中一共展示了TBinaryProtocol.TBinaryProtocolFactory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def __init__(self,
processor,
lsocket,
inputProtocolFactory=None,
outputProtocolFactory=None,
threads=10):
self.processor = processor
self.socket = lsocket
self.in_protocol = inputProtocolFactory or TBinaryProtocolFactory()
self.out_protocol = outputProtocolFactory or self.in_protocol
self.threads = int(threads)
self.clients = {}
self.tasks = Queue.Queue()
self._read, self._write = socket.socketpair()
self.prepared = False
self._stop = False
示例2: __init__
# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def __init__(self,
processor,
lsocket,
inputProtocolFactory=None,
outputProtocolFactory=None,
threads=10):
self.processor = processor
self.socket = lsocket
self.in_protocol = inputProtocolFactory or TBinaryProtocolFactory()
self.out_protocol = outputProtocolFactory or self.in_protocol
self.threads = int(threads)
self.clients = {}
self.tasks = queue.Queue()
self._read, self._write = socket.socketpair()
self.prepared = False
self._stop = False
示例3: prepareClient
# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def prepareClient(client, username, password):
yield client.authenticate(username, password)
channel = yield client.channel(1)
yield channel.channel_open()
yield channel.exchange_declare(exchange=servicesExchange, type="direct")
yield channel.exchange_declare(exchange=responsesExchange, type="direct")
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
# To trigger an unroutable message error (caught in the above
# gotTransportError errback), change the routing key (i.e.,
# calculatorKey) in the following to be something invalid, like
# calculatorKey + 'xxx'.
thriftClient = yield client.createThriftClient(responsesExchange,
servicesExchange, calculatorKey, tutorial.Calculator.Client,
iprot_factory=pfactory, oprot_factory=pfactory)
defer.returnValue(thriftClient)
示例4: __init__
# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def __init__(self, *args):
if (len(args) == 2):
self.__initArgs__(args[0], args[1],
TTransport.TTransportFactoryBase(),
TTransport.TTransportFactoryBase(),
TBinaryProtocol.TBinaryProtocolFactory(),
TBinaryProtocol.TBinaryProtocolFactory())
elif (len(args) == 4):
self.__initArgs__(args[0], args[1], args[2], args[2], args[3], args[3])
elif (len(args) == 6):
self.__initArgs__(args[0], args[1], args[2], args[3], args[4], args[5])
示例5: __init__
# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def __init__(self, *args):
if (len(args) == 2):
self.__initArgs__(args[0], args[1],
TTransport.TTransportFactoryBase(),
TTransport.TTransportFactoryBase(),
TBinaryProtocol.TBinaryProtocolFactory(),
TBinaryProtocol.TBinaryProtocolFactory())
elif (len(args) == 4):
self.__initArgs__(args[0], args[1], args[2], args[2], args[3], args[3])
elif (len(args) == 6):
self.__initArgs__(args[0], args[1], args[2], args[3], args[4], args[5])
示例6: prepareClient
# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def prepareClient(client, username, password):
yield client.authenticate(username, password)
handler = CalculatorHandler()
processor = tutorial.Calculator.Processor(handler)
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
yield client.createThriftServer(responsesExchange, servicesExchange,
calculatorKey, processor, calculatorQueue, iprot_factory=pfactory,
oprot_factory=pfactory)
示例7: init_pool
# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def init_pool(self):
return PoolClient(Client, TStreamPool(self.host, self.port, max_stream=self.max_stream), TBinaryProtocolFactory())
示例8: get_client
# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def get_client(self, host, port, max_connections = 0):
key = "%s:%s" % (host, port)
if key not in self.client_pools:
self.__class__.client_pools[key] = PoolClient(Client, TStreamPool(host, port, max_stream=max_connections), TBinaryProtocolFactory())
elif max_connections:
self.client_pools[key]._itrans_pool._max_stream = max_connections
return self.client_pools[key]