blob: 2c3ae4f66f4b1b90a45debb7ac6593aa82047ccf [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 Clark159383f2008-11-11 05:46:04 +000055 def validate
56 end
57
Kevin Clarkca8a1b32008-06-18 01:17:06 +000058 end
59
60 class Fibonacci_result
61 include Thrift::Struct
Kevin Clark7dc7f752008-10-16 19:15:20 +000062 SUCCESS = 0
63
Kevin Clark23193752008-06-18 01:18:07 +000064 Thrift::Struct.field_accessor self, :success
Kevin Clarkca8a1b32008-06-18 01:17:06 +000065 FIELDS = {
Kevin Clark7dc7f752008-10-16 19:15:20 +000066 SUCCESS => {:type => Thrift::Types::I32, :name => 'success'}
Kevin Clarkca8a1b32008-06-18 01:17:06 +000067 }
Kevin Clark159383f2008-11-11 05:46:04 +000068 def validate
69 end
70
Kevin Clarkca8a1b32008-06-18 01:17:06 +000071 end
72
73 end
74
75 end