Subversion Repositories SmartDukaan

Rev

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

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