blob: 832098b5ca8e61c706af9295e7da405a134773c9 [file] [log] [blame]
Kevin Clarkca8a1b32008-06-18 01:17:06 +00001#
2# Autogenerated by Thrift
3#
4# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5#
6
Kevin Clarkca8a1b32008-06-18 01:17:06 +00007require 'thrift'
Kevin Clark3836f9b2008-06-24 01:05:51 +00008require 'thrift/protocol'
Kevin Clark2bd3a302008-06-26 17:49:49 +00009require File.dirname(__FILE__) + '/Benchmark_types'
Kevin Clarkca8a1b32008-06-18 01:17:06 +000010
11 module ThriftBenchmark
12 module BenchmarkService
13 class Client
14 include Thrift::Client
15
16 def fibonacci(n)
17 send_fibonacci(n)
18 return recv_fibonacci()
19 end
20
21 def send_fibonacci(n)
22 send_message('fibonacci', Fibonacci_args, :n => n)
23 end
24
25 def recv_fibonacci()
26 result = receive_message(Fibonacci_result)
27 return result.success unless result.success.nil?
28 raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'fibonacci failed: unknown result')
29 end
30
31 end
32
33 class Processor
34 include Thrift::Processor
35
36 def process_fibonacci(seqid, iprot, oprot)
37 args = read_args(iprot, Fibonacci_args)
38 result = Fibonacci_result.new()
39 result.success = @handler.fibonacci(args.n)
40 write_result(result, oprot, 'fibonacci', seqid)
41 end
42
43 end
44
45 # HELPER FUNCTIONS AND STRUCTURES
46
47 class Fibonacci_args
48 include Thrift::Struct
Kevin Clark7dc7f752008-10-16 19:15:20 +000049 N = 1
50
Kevin Clark23193752008-06-18 01:18:07 +000051 Thrift::Struct.field_accessor self, :n
Kevin Clarkca8a1b32008-06-18 01:17:06 +000052 FIELDS = {
Kevin Clark7dc7f752008-10-16 19:15:20 +000053 N => {:type => Thrift::Types::BYTE, :name => 'n'}
Kevin Clarkca8a1b32008-06-18 01:17:06 +000054 }
Kevin Clarkd6b71822009-01-06 01:34:28 +000055
56 def struct_fields; FIELDS; end
57
Kevin Clark159383f2008-11-11 05:46:04 +000058 def validate
59 end
60
Kevin Clarkca8a1b32008-06-18 01:17:06 +000061 end
62
63 class Fibonacci_result
64 include Thrift::Struct
Kevin Clark7dc7f752008-10-16 19:15:20 +000065 SUCCESS = 0
66
Kevin Clark23193752008-06-18 01:18:07 +000067 Thrift::Struct.field_accessor self, :success
Kevin Clarkca8a1b32008-06-18 01:17:06 +000068 FIELDS = {
Kevin Clark7dc7f752008-10-16 19:15:20 +000069 SUCCESS => {:type => Thrift::Types::I32, :name => 'success'}
Kevin Clarkca8a1b32008-06-18 01:17:06 +000070 }
Kevin Clarkd6b71822009-01-06 01:34:28 +000071
72 def struct_fields; FIELDS; end
73
Kevin Clark159383f2008-11-11 05:46:04 +000074 def validate
75 end
76
Kevin Clarkca8a1b32008-06-18 01:17:06 +000077 end
78
79 end
80
81 end