點擊(此處)摺疊或打開
-
@ECHO OFF
-
set THRIFT_CODEDEFINE=main.thrift
-
if "%1"=="" goto genDefault
-
-
:genDefault
-
call thrift-0.7.0.exe --gen
py main.thrift
-
goto end
-
-
:genByArg
-
call thrift-0.7.0.exe --gen
java:hashcode %1
-
call thrift-0.7.0.exe --gen
php %1
-
call thrift-0.7.0.exe --gen
py %1
-
goto end
-
-
:exit
-
exit /b 1
-
-
:end
- exit /b 0
點擊(此處)摺疊或打開
- namespace py thriftlib.adspub.thrift
- exception ThrfitException {
- 1: i32 errCode,
- 2: string msg
- }
- struct ResultInfo{
- 1: i32 err,
- 2: string value,
- 3: string msg
- }
- struct A {
- 1: string type,
- 2: i32 age
- }
- struct B {
- 1: i32 id,
- 2: list a
- }
-
service InfoService { - ResultInfo deployTemplateCreate(1:B deployObject,2:string username);
- list deployPlanList(1:string planName);
- }
-
handler = DeployInfoHandler()
# 這個就是實現了接口方法的實現類
-
processor = DeployInfoService.Processor(handler)
-
transport = TSocket.TServerSocket("0.0.0.0", 10001)
-
tfactory = TTransport.TBufferedTransportFactory()
-
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
-
server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
- server.serve()