blob: 42c8aecfc0d236fa3b28055ab9ae20e731a258c9 [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 Clark23193752008-06-18 01:18:07 +000049 Thrift::Struct.field_accessor self, :n
Kevin Clarkca8a1b32008-06-18 01:17:06 +000050 FIELDS = {
51 1 => {:type => Thrift::Types::BYTE, :name => 'n'}
52 }
53 end
54
55 class Fibonacci_result
56 include Thrift::Struct
Kevin Clark23193752008-06-18 01:18:07 +000057 Thrift::Struct.field_accessor self, :success
Kevin Clarkca8a1b32008-06-18 01:17:06 +000058 FIELDS = {
59 0 => {:type => Thrift::Types::I32, :name => 'success'}
60 }
61 end
62
63 end
64
65 end