blob: ba6b3e48e1fe9162462dcc89b0a400a0449d66fd [file] [log] [blame]
Kevin Clarke0fddde2008-06-18 01:16:02 +00001#
2# Autogenerated by Thrift
3#
4# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5#
6
7require 'thrift/protocol'
8require 'thrift'
9require 'ThriftSpec_types'
10
11 module SpecNamespace
12 module NonblockingService
13 class Client
14 include Thrift::Client
15
16 def greeting(english)
17 send_greeting(english)
18 return recv_greeting()
19 end
20
21 def send_greeting(english)
22 send_message('greeting', Greeting_args, :english => english)
23 end
24
25 def recv_greeting()
26 result = receive_message(Greeting_result)
27 return result.success unless result.success.nil?
28 raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
29 end
30
31 def block()
32 send_block()
33 return recv_block()
34 end
35
36 def send_block()
37 send_message('block', Block_args)
38 end
39
40 def recv_block()
41 result = receive_message(Block_result)
42 return result.success unless result.success.nil?
43 raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'block failed: unknown result')
44 end
45
Kevin Clark980e4452008-06-18 01:19:59 +000046 def unblock(n)
47 send_unblock(n)
Kevin Clarke0fddde2008-06-18 01:16:02 +000048 end
49
Kevin Clark980e4452008-06-18 01:19:59 +000050 def send_unblock(n)
51 send_message('unblock', Unblock_args, :n => n)
Kevin Clarke0fddde2008-06-18 01:16:02 +000052 end
53 def shutdown()
54 send_shutdown()
55 end
56
57 def send_shutdown()
58 send_message('shutdown', Shutdown_args)
59 end
60 def sleep(seconds)
61 send_sleep(seconds)
62 recv_sleep()
63 end
64
65 def send_sleep(seconds)
66 send_message('sleep', Sleep_args, :seconds => seconds)
67 end
68
69 def recv_sleep()
70 result = receive_message(Sleep_result)
71 return
72 end
73
74 end
75
76 class Processor
77 include Thrift::Processor
78
79 def process_greeting(seqid, iprot, oprot)
80 args = read_args(iprot, Greeting_args)
81 result = Greeting_result.new()
82 result.success = @handler.greeting(args.english)
83 write_result(result, oprot, 'greeting', seqid)
84 end
85
86 def process_block(seqid, iprot, oprot)
87 args = read_args(iprot, Block_args)
88 result = Block_result.new()
89 result.success = @handler.block()
90 write_result(result, oprot, 'block', seqid)
91 end
92
93 def process_unblock(seqid, iprot, oprot)
94 args = read_args(iprot, Unblock_args)
Kevin Clark980e4452008-06-18 01:19:59 +000095 @handler.unblock(args.n)
Kevin Clarke0fddde2008-06-18 01:16:02 +000096 return
97 end
98
99 def process_shutdown(seqid, iprot, oprot)
100 args = read_args(iprot, Shutdown_args)
101 @handler.shutdown()
102 return
103 end
104
105 def process_sleep(seqid, iprot, oprot)
106 args = read_args(iprot, Sleep_args)
107 result = Sleep_result.new()
108 @handler.sleep(args.seconds)
109 write_result(result, oprot, 'sleep', seqid)
110 end
111
112 end
113
114 # HELPER FUNCTIONS AND STRUCTURES
115
116 class Greeting_args
117 include Thrift::Struct
Kevin Clark23193752008-06-18 01:18:07 +0000118 Thrift::Struct.field_accessor self, :english
Kevin Clarke0fddde2008-06-18 01:16:02 +0000119 FIELDS = {
120 1 => {:type => Thrift::Types::BOOL, :name => 'english'}
121 }
122 end
123
124 class Greeting_result
125 include Thrift::Struct
Kevin Clark23193752008-06-18 01:18:07 +0000126 Thrift::Struct.field_accessor self, :success
Kevin Clarke0fddde2008-06-18 01:16:02 +0000127 FIELDS = {
128 0 => {:type => Thrift::Types::STRUCT, :name => 'success', :class => Hello}
129 }
130 end
131
132 class Block_args
133 include Thrift::Struct
134 FIELDS = {
135
136 }
137 end
138
139 class Block_result
140 include Thrift::Struct
Kevin Clark23193752008-06-18 01:18:07 +0000141 Thrift::Struct.field_accessor self, :success
Kevin Clarke0fddde2008-06-18 01:16:02 +0000142 FIELDS = {
143 0 => {:type => Thrift::Types::BOOL, :name => 'success'}
144 }
145 end
146
147 class Unblock_args
148 include Thrift::Struct
Kevin Clark980e4452008-06-18 01:19:59 +0000149 Thrift::Struct.field_accessor self, :n
Kevin Clarke0fddde2008-06-18 01:16:02 +0000150 FIELDS = {
Kevin Clark980e4452008-06-18 01:19:59 +0000151 1 => {:type => Thrift::Types::I32, :name => 'n'}
Kevin Clarke0fddde2008-06-18 01:16:02 +0000152 }
153 end
154
155 class Unblock_result
156 include Thrift::Struct
157 FIELDS = {
158
159 }
160 end
161
162 class Shutdown_args
163 include Thrift::Struct
164 FIELDS = {
165
166 }
167 end
168
169 class Shutdown_result
170 include Thrift::Struct
171 FIELDS = {
172
173 }
174 end
175
176 class Sleep_args
177 include Thrift::Struct
Kevin Clark23193752008-06-18 01:18:07 +0000178 Thrift::Struct.field_accessor self, :seconds
Kevin Clarke0fddde2008-06-18 01:16:02 +0000179 FIELDS = {
180 1 => {:type => Thrift::Types::DOUBLE, :name => 'seconds'}
181 }
182 end
183
184 class Sleep_result
185 include Thrift::Struct
186 FIELDS = {
187
188 }
189 end
190
191 end
192
193 end