mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
5ddabb8e3f
There are three major parts of this: 1/ New callback-style interfaces for for a few key Thrift components: TAsyncProcessor for servers and TAsyncChannel for clients. 2/ Concrete implementations of TAsyncChannel and a server for TAsyncProcessor based on evhttp. 3/ Async-style code generation for C++ git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005127 13f79535-47bb-0310-9956-ffa450edef68
24 lines
600 B
Python
Executable File
24 lines
600 B
Python
Executable File
#!/usr/bin/env python
|
|
import sys
|
|
import time
|
|
from thrift.transport import TTransport
|
|
from thrift.transport import TSocket
|
|
from thrift.protocol import TBinaryProtocol
|
|
from thrift.server import THttpServer
|
|
from aggr import Aggr
|
|
|
|
class AggrHandler(Aggr.Iface):
|
|
def __init__(self):
|
|
self.values = []
|
|
|
|
def addValue(self, value):
|
|
self.values.append(value)
|
|
|
|
def getValues(self, ):
|
|
time.sleep(1)
|
|
return self.values
|
|
|
|
processor = Aggr.Processor(AggrHandler())
|
|
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
|
|
THttpServer.THttpServer(processor, ('', int(sys.argv[1])), pfactory).serve()
|