blob: 411a6f0737a5c5c66874ad6c8325ca0a6669999e [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
46 def unblock()
47 send_unblock()
48 end
49
50 def send_unblock()
51 send_message('unblock', Unblock_args)
52 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)
95 @handler.unblock()
96 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
149 FIELDS = {
150
151 }
152 end
153
154 class Unblock_result
155 include Thrift::Struct
156 FIELDS = {
157
158 }
159 end
160
161 class Shutdown_args
162 include Thrift::Struct
163 FIELDS = {
164
165 }
166 end
167
168 class Shutdown_result
169 include Thrift::Struct
170 FIELDS = {
171
172 }
173 end
174
175 class Sleep_args
176 include Thrift::Struct
Kevin Clark23193752008-06-18 01:18:07 +0000177 Thrift::Struct.field_accessor self, :seconds
Kevin Clarke0fddde2008-06-18 01:16:02 +0000178 FIELDS = {
179 1 => {:type => Thrift::Types::DOUBLE, :name => 'seconds'}
180 }
181 end
182
183 class Sleep_result
184 include Thrift::Struct
185 FIELDS = {
186
187 }
188 end
189
190 end
191
192 end