Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
301 ashish 1
#
2
# Autogenerated by Thrift
3
#
4
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
#
6
 
7
from thrift.Thrift import *
8
import fb303.FacebookService
9
from ttypes import *
10
from thrift.Thrift import TProcessor
11
from thrift.transport import TTransport
12
from thrift.protocol import TBinaryProtocol
13
try:
14
  from thrift.protocol import fastbinary
15
except:
16
  fastbinary = None
17
 
18
 
19
class Iface(fb303.FacebookService.Iface):
20
  def Log(self, messages):
21
    """
22
    Parameters:
23
     - messages
24
    """
25
    pass
26
 
27
 
28
class Client(fb303.FacebookService.Client, Iface):
29
  def __init__(self, iprot, oprot=None):
30
    fb303.FacebookService.Client.__init__(self, iprot, oprot)
31
 
32
  def Log(self, messages):
33
    """
34
    Parameters:
35
     - messages
36
    """
37
    self.send_Log(messages)
38
    return self.recv_Log()
39
 
40
  def send_Log(self, messages):
41
    self._oprot.writeMessageBegin('Log', TMessageType.CALL, self._seqid)
42
    args = Log_args()
43
    args.messages = messages
44
    args.write(self._oprot)
45
    self._oprot.writeMessageEnd()
46
    self._oprot.trans.flush()
47
 
48
  def recv_Log(self, ):
49
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
50
    if mtype == TMessageType.EXCEPTION:
51
      x = TApplicationException()
52
      x.read(self._iprot)
53
      self._iprot.readMessageEnd()
54
      raise x
55
    result = Log_result()
56
    result.read(self._iprot)
57
    self._iprot.readMessageEnd()
58
    if result.success != None:
59
      return result.success
60
    raise TApplicationException(TApplicationException.MISSING_RESULT, "Log failed: unknown result");
61
 
62
 
63
class Processor(fb303.FacebookService.Processor, Iface, TProcessor):
64
  def __init__(self, handler):
65
    fb303.FacebookService.Processor.__init__(self, handler)
66
    self._processMap["Log"] = Processor.process_Log
67
 
68
  def process(self, iprot, oprot):
69
    (name, type, seqid) = iprot.readMessageBegin()
70
    if name not in self._processMap:
71
      iprot.skip(TType.STRUCT)
72
      iprot.readMessageEnd()
73
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
74
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
75
      x.write(oprot)
76
      oprot.writeMessageEnd()
77
      oprot.trans.flush()
78
      return
79
    else:
80
      self._processMap[name](self, seqid, iprot, oprot)
81
    return True
82
 
83
  def process_Log(self, seqid, iprot, oprot):
84
    args = Log_args()
85
    args.read(iprot)
86
    iprot.readMessageEnd()
87
    result = Log_result()
88
    result.success = self._handler.Log(args.messages)
89
    oprot.writeMessageBegin("Log", TMessageType.REPLY, seqid)
90
    result.write(oprot)
91
    oprot.writeMessageEnd()
92
    oprot.trans.flush()
93
 
94
 
95
# HELPER FUNCTIONS AND STRUCTURES
96
 
97
class Log_args:
98
  """
99
  Attributes:
100
   - messages
101
  """
102
 
103
  thrift_spec = (
104
    None, # 0
105
    (1, TType.LIST, 'messages', (TType.STRUCT,(LogEntry, LogEntry.thrift_spec)), None, ), # 1
106
  )
107
 
108
  def __init__(self, messages=None,):
109
    self.messages = messages
110
 
111
  def read(self, iprot):
112
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
113
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
114
      return
115
    iprot.readStructBegin()
116
    while True:
117
      (fname, ftype, fid) = iprot.readFieldBegin()
118
      if ftype == TType.STOP:
119
        break
120
      if fid == 1:
121
        if ftype == TType.LIST:
122
          self.messages = []
123
          (_etype3, _size0) = iprot.readListBegin()
124
          for _i4 in xrange(_size0):
125
            _elem5 = LogEntry()
126
            _elem5.read(iprot)
127
            self.messages.append(_elem5)
128
          iprot.readListEnd()
129
        else:
130
          iprot.skip(ftype)
131
      else:
132
        iprot.skip(ftype)
133
      iprot.readFieldEnd()
134
    iprot.readStructEnd()
135
 
136
  def write(self, oprot):
137
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
138
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
139
      return
140
    oprot.writeStructBegin('Log_args')
141
    if self.messages != None:
142
      oprot.writeFieldBegin('messages', TType.LIST, 1)
143
      oprot.writeListBegin(TType.STRUCT, len(self.messages))
144
      for iter6 in self.messages:
145
        iter6.write(oprot)
146
      oprot.writeListEnd()
147
      oprot.writeFieldEnd()
148
    oprot.writeFieldStop()
149
    oprot.writeStructEnd()
150
 
151
  def __repr__(self):
152
    L = ['%s=%r' % (key, value)
153
      for key, value in self.__dict__.iteritems()]
154
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
155
 
156
  def __eq__(self, other):
157
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
158
 
159
  def __ne__(self, other):
160
    return not (self == other)
161
 
162
class Log_result:
163
  """
164
  Attributes:
165
   - success
166
  """
167
 
168
  thrift_spec = (
169
    (0, TType.I32, 'success', None, None, ), # 0
170
  )
171
 
172
  def __init__(self, success=None,):
173
    self.success = success
174
 
175
  def read(self, iprot):
176
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
177
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
178
      return
179
    iprot.readStructBegin()
180
    while True:
181
      (fname, ftype, fid) = iprot.readFieldBegin()
182
      if ftype == TType.STOP:
183
        break
184
      if fid == 0:
185
        if ftype == TType.I32:
186
          self.success = iprot.readI32();
187
        else:
188
          iprot.skip(ftype)
189
      else:
190
        iprot.skip(ftype)
191
      iprot.readFieldEnd()
192
    iprot.readStructEnd()
193
 
194
  def write(self, oprot):
195
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
196
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
197
      return
198
    oprot.writeStructBegin('Log_result')
199
    if self.success != None:
200
      oprot.writeFieldBegin('success', TType.I32, 0)
201
      oprot.writeI32(self.success)
202
      oprot.writeFieldEnd()
203
    oprot.writeFieldStop()
204
    oprot.writeStructEnd()
205
 
206
  def __repr__(self):
207
    L = ['%s=%r' % (key, value)
208
      for key, value in self.__dict__.iteritems()]
209
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
210
 
211
  def __eq__(self, other):
212
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
213
 
214
  def __ne__(self, other):
215
    return not (self == other)
216
 
217