Commit be7739c6 authored by Vaastav Anand's avatar Vaastav Anand

Revert to original lua nginx thrift format

parent 83a4ac1c
......@@ -37,13 +37,20 @@ end
--设置连接池的大小
--Maxtotal 连接池大小
--
function GenericObjectPool:setMaxTotal(maxTotal)
function GenericObjectPool:setMaxSize(maxTotal)
self.maxTotal = maxTotal
end
function GenericObjectPool:setMaxIdleTime(maxIdleTime)
self.maxIdleTime = maxIdleTime
end
function GenericObjectPool:clear()
end
function GenericObjectPool:remove()
end
return GenericObjectPool
......@@ -2,13 +2,13 @@
----Author: xiajun
----Date: 20151120
----
local function ttype(obj)
function ttype(obj)
if type(obj) == 'table' and obj.__type and type(obj.__type) == 'string' then
return obj.__type
end
return type(obj)
end
local function __obj_index(self, key)
function __obj_index(self, key)
local obj = rawget(self, key)
if obj ~=nil then
return obj
......@@ -19,7 +19,6 @@ local function __obj_index(self, key)
end
return nil
end
local Object = {
__type = 'Object',
__mt = {
......
......@@ -21,13 +21,13 @@ local TProtocol = require('TProtocol')
local libluabpack = require('libluabpack')
local libluabitwise = require('libluabitwise')
local Thrift = require 'Thrift'
local TType = Thrift.TType
local __TObject = Thrift.__TObject
local ttype = Thrift.ttype
local terror = Thrift.terror
local TProtocolException = TProtocol.TProtocolException
local TProtocolBase = TProtocol.TProtocolBase
local TProtocolFactory = TProtocol.TProtocolFactory
local TType = Thrift[1]
local __TObject = Thrift[3]
local ttype = Thrift[8]
local terror = Thrift[9]
local TProtocolException = TProtocol[1]
local TProtocolBase = TProtocol[2]
local TProtocolFactory = TProtocol[3]
local TBinaryProtocol = __TObject.new(TProtocolBase, {
......
......@@ -18,12 +18,12 @@
--
local TTransport = require 'TTransport'
local TTransportException = TTransport.TTransportException
local TTransportBase = TTransport.TTransportBase
local TTransportFactoryBase = TTransport.TTransportFactoryBase
local TTransportException = TTransport[1]
local TTransportBase = TTransport[2]
local TTransportFactoryBase = TTransport[3]
local Thrift = require 'Thrift'
local ttype = Thrift.ttype
local terror = Thrift.terror
local ttype = Thrift[8]
local terror = Thrift[9]
local TBufferedTransport = TTransportBase:new{
__type = 'TBufferedTransport',
......
......@@ -22,13 +22,15 @@ local libluabpack = require 'libluabpack'
local libluabitwise = require 'libluabitwise'
local liblualongnumber = require 'liblualongnumber'
local Thrift = require 'Thrift'
local TType = Thrift.TType
local __TObject = Thrift.__TObject
local ttype = Thrift.ttype
local terror = Thrift.terror
local TProtocolException = TProtocol.TProtocolException
local TProtocolBase = TProtocol.TProtocolBase
local TProtocolFactory = TProtocol.TProtocolFactory
local TType = Thrift[1]
local __TObject = Thrift[3]
local TException = Thrift[4]
local ttype = Thrift[8]
local terror = Thrift[9]
local ttable_size = Thrift[10]
local TProtocolException = TProtocol[1]
local TProtocolBase = TProtocol[2]
local TProtocolFactory = TProtocol[3]
local TCompactProtocol = __TObject.new(TProtocolBase, {
......
......@@ -21,11 +21,11 @@ local TTransport = require 'TTransport'
local libluabpack = require 'libluabpack'
local TProtocol = require 'TProtocol'
local Thrift = require 'Thrift'
local TProtocolException = TProtocol.TProtocolException
local TTransportBase = TTransport.TTransportBase
local TTransportFactoryBase = TTransport.TTransportFactoryBase
local ttype = Thrift.ttype
local terror = Thrift.terror
local TProtocolException = TProtocol[2]
local TTransportBase = TTransport[2]
local TTransportFactoryBase = TTransport[3]
local ttype = Thrift[8]
local terror = Thrift[9]
local TFramedTransport = TTransportBase:new{
......
......@@ -17,14 +17,11 @@
-- under the License.
--
local Thrift = require 'Thrift'
local TTransport = require 'TTransport'
local TProtocol = require 'TProtocol'
local TProtocolException = TProtocol.TProtocolException
local TTransportBase = TTransport.TTransportBase
local TTransportFactoryBase = TTransport.TTransportFactoryBase
local ttype = Thrift.ttype
local terror = Thrift.terror
local TProtocolException = TProtocol[2]
local TTransportBase = TTransport[2]
local TTransportFactoryBase = TTransport[3]
local THttpTransport = TTransportBase:new{
__type = 'THttpTransport',
......
......@@ -23,13 +23,14 @@ local libluabpack = require 'libluabpack'
local libluabitwise = require 'libluabitwise'
local liblualongnumber = require "liblualongnumber"
local TType = Thrift.TType
local __TObject = Thrift.__TObject
local TProtocolException = TProtocol.TProtocolException
local TProtocolBase = TProtocol.TProtocolBase
local TProtocolFactory = TProtocol.TProtocolFactory
local ttype = Thrift.ttype
local terror = Thrift.terror
local TType = Thrift[1]
local __TObject = Thrift[3]
local TException = Thrift[4]
local TProtocolException = TProtocol[1]
local TProtocolBase = TProtocol[2]
local TProtocolFactory = TProtocol[3]
local ttype = Thrift[8]
local terror = Thrift[9]
local TJSONProtocol = __TObject.new(TProtocolBase, {
__type = 'TJSONProtocol',
......@@ -91,9 +92,9 @@ local EscapeCharVals = {
local JSONCharTable = {
--0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, 98,116,110, 0,102,114, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1,34, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 98,116,110, 0,102,114, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1,34, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
}
-- character table string
......
......@@ -18,10 +18,8 @@
--
local TTransport = require 'TTransport'
local Thrift = require 'Thrift'
local TTransportException = TTransport.TTransportException
local TTransportBase = TTransport.TTransportBase
local terror = Thrift.terror
local TTransportException = TTransport[1]
local TTransportBase = TTransport[2]
local TMemoryBuffer = TTransportBase:new{
__type = 'TMemoryBuffer',
......
......@@ -18,10 +18,9 @@
--
local Thrift = require 'Thrift'
local TType = Thrift.TType
local __TObject = Thrift.__TObject
local TException = Thrift.TException
local ttype = Thrift.ttype
local TType = Thrift[1]
local __TObject = Thrift[3]
local TException = Thrift[4]
local TProtocolException = TException:new {
UNKNOWN = 0,
......@@ -165,8 +164,4 @@ local TProtocolFactory = __TObject:new{
}
function TProtocolFactory:getProtocol(trans) end
return {
TProtocolException=TProtocolException,
TProtocolBase=TProtocolBase,
TProtocolFactory=TProtocolFactory
}
return {TProtocolException, TProtocolBase, TProtocolFactory}
......@@ -17,11 +17,12 @@
--
local TTransport = require 'TTransport'
local TTransportException = TTransport.TTransportException
local TTransportBase = TTransport.TTransportBase
local TTransportException = TTransport[1]
local TTransportBase = TTransport[2]
local Thrift = require 'Thrift'
local ttype = Thrift.ttype
local terror = Thrift.terror
local ttype = Thrift[8]
local terror = Thrift[9]
-- TSocketBase
local TSocketBase = TTransportBase:new{
......
......@@ -18,9 +18,8 @@
--
local Thrift = require('Thrift')
local __TObject = Thrift.__TObject
local TException = Thrift.TException
local terror = Thrift.terror
local __TObject = Thrift[3]
local TException = Thrift[4]
local TTransportException = TException:new {
UNKNOWN = 0,
......@@ -95,8 +94,4 @@ function TTransportFactoryBase:getTransport(trans)
return trans
end
return {
TTransportException=TTransportException,
TTransportBase=TTransportBase,
TTransportFactoryBase=TTransportFactoryBase
}
return {TTransportException, TTransportBase, TTransportFactoryBase}
......@@ -50,6 +50,7 @@ end
local version = 1.0
-- Thrift[1]
local TType = {
STOP = 0,
VOID = 1,
......@@ -70,6 +71,7 @@ local TType = {
UTF16 = 17
}
-- Thrift[2]
local TMessageType = {
CALL = 1,
REPLY = 2,
......@@ -78,7 +80,7 @@ local TMessageType = {
}
-- Recursive __index function to achieve inheritance
local function __tobj_index(self, key)
function __tobj_index(self, key)
local v = rawget(self, key)
if v ~= nil then
return v
......@@ -93,6 +95,7 @@ local function __tobj_index(self, key)
end
-- Basic Thrift-Lua Object
-- Thrift[3]
local __TObject = {
__type = '__TObject',
__mt = {
......@@ -112,7 +115,7 @@ function __TObject:new(init_obj)
end
-- Return a string representation of any lua variable
local function thrift_print_r(t)
function thrift_print_r(t)
local ret = ''
local ltype = type(t)
if (ltype == 'table') then
......@@ -130,6 +133,7 @@ local function thrift_print_r(t)
end
-- Basic Exception
-- Thrift[4]
local TException = __TObject:new{
message,
errorCode,
......@@ -235,6 +239,7 @@ function TException:write(oprot)
end
-- Basic Client (used in generated lua code)
-- Thrift[6]
local __TClient = __TObject:new{
__type = '__TClient',
_seqid = 0
......@@ -265,6 +270,7 @@ function __TClient:close()
end
-- Basic Processor (used in generated lua code)
-- Thrift[7]
local __TProcessor = __TObject:new{
__type = '__TProcessor'
}
......@@ -281,15 +287,5 @@ function __TProcessor:new(obj)
return __TObject.new(self, obj)
end
return {
TType=TType,
TMessageType=TMessageType,
__TObject=__TObject,
TException=TException,
TApplicationException=TApplicationException,
__TClient=__TClient,
__TProcessor=__TProcessor,
ttype=ttype,
terror=terror,
ttable_size=ttable_size
}
return {TType, TMessageType, __TObject, TException,
TApplicationException, __TClient, __TProcessor, ttype, terror, ttable_size}
......@@ -7,17 +7,15 @@
local Thrift = require 'Thrift'
local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local social_network_ttypes = require 'social_network_ttypes'
local ServiceException = social_network_ttypes.ServiceException
local TType = Thrift[1]
local TMessageType = Thrift[2]
local __TObject = Thrift[3]
local TApplicationException = Thrift[5]
local __TClient = Thrift[6]
local __TProcessor = Thrift[7]
local ttype = Thrift[8]
local ttable_size = Thrift[10]
require 'social_network_ttypes'
SocialGraphServiceClient = __TObject.new(__TClient, {
__type = 'SocialGraphServiceClient'
......
......@@ -15,8 +15,7 @@ local __TClient = Thrift[6]
local __TProcessor = Thrift[7]
local ttype = Thrift[8]
local ttable_size = Thrift[10]
local social_network_ttypes = require 'social_network_ttypes'
local ServiceException = social_network_ttypes.ServiceException
require 'social_network_ttypes'
TextServiceClient = __TObject.new(__TClient, {
__type = 'TextServiceClient'
......
......@@ -15,8 +15,7 @@ local __TClient = Thrift[6]
local __TProcessor = Thrift[7]
local ttype = Thrift[8]
local ttable_size = Thrift[10]
local social_network_ttypes = require 'social_network_ttypes'
local ServiceException = social_network_ttypes.ServiceException
require 'social_network_ttypes'
UniqueIdServiceClient = __TObject.new(__TClient, {
__type = 'UniqueIdServiceClient'
......
......@@ -15,8 +15,7 @@ local __TClient = Thrift[6]
local __TProcessor = Thrift[7]
local ttype = Thrift[8]
local ttable_size = Thrift[10]
local social_network_ttypes = require 'social_network_ttypes'
local ServiceException = social_network_ttypes.ServiceException
require 'social_network_ttypes'
UserServiceClient = __TObject.new(__TClient, {
__type = 'UserServiceClient'
......
......@@ -15,9 +15,7 @@ local __TClient = Thrift[6]
local __TProcessor = Thrift[7]
local ttype = Thrift[8]
local ttable_size = Thrift[10]
local social_network_ttypes = require 'social_network_ttypes'
local ServiceException = social_network_ttypes.ServiceException
local Post = social_network_ttypes.Post
require 'social_network_ttypes'
UserTimelineServiceClient = __TObject.new(__TClient, {
__type = 'UserTimelineServiceClient'
......
......@@ -526,7 +526,6 @@ function Post:write(oprot)
oprot:writeStructEnd()
end
<<<<<<< HEAD
BaseRpcResponse = __TObject:new{
baggage
}
......@@ -875,16 +874,3 @@ function UrlListRpcResponse:write(oprot)
oprot:writeFieldStop()
oprot:writeStructEnd()
end
=======
return {
ErrorCode=ErrorCode,
PostType=PostType,
User=User,
ServiceException=ServiceException,
Media=Media,
Url=Url,
UserMention=UserMention,
Creator=Creator,
Post=Post
}
>>>>>>> 4be4b8007624671631caa95e8d1f2252a22f8fc8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment