80 lines
1.7 KiB
Ruby
80 lines
1.7 KiB
Ruby
#
|
|
# Autogenerated by Thrift Compiler (0.11.0)
|
|
#
|
|
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
#
|
|
|
|
require 'thrift'
|
|
require 'base/base_service_types'
|
|
|
|
module Base
|
|
module BaseService
|
|
class Client
|
|
include ::Thrift::Client
|
|
|
|
def greeting(english)
|
|
send_greeting(english)
|
|
return recv_greeting()
|
|
end
|
|
|
|
def send_greeting(english)
|
|
send_message('greeting', Greeting_args, :english => english)
|
|
end
|
|
|
|
def recv_greeting()
|
|
result = receive_message(Greeting_result)
|
|
return result.success unless result.success.nil?
|
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
|
|
end
|
|
|
|
end
|
|
|
|
class Processor
|
|
include ::Thrift::Processor
|
|
|
|
def process_greeting(seqid, iprot, oprot)
|
|
args = read_args(iprot, Greeting_args)
|
|
result = Greeting_result.new()
|
|
result.success = @handler.greeting(args.english)
|
|
write_result(result, oprot, 'greeting', seqid)
|
|
end
|
|
|
|
end
|
|
|
|
# HELPER FUNCTIONS AND STRUCTURES
|
|
|
|
class Greeting_args
|
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
ENGLISH = 1
|
|
|
|
FIELDS = {
|
|
ENGLISH => {:type => ::Thrift::Types::BOOL, :name => 'english'}
|
|
}
|
|
|
|
def struct_fields; FIELDS; end
|
|
|
|
def validate
|
|
end
|
|
|
|
::Thrift::Struct.generate_accessors self
|
|
end
|
|
|
|
class Greeting_result
|
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
SUCCESS = 0
|
|
|
|
FIELDS = {
|
|
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Base::Hello}
|
|
}
|
|
|
|
def struct_fields; FIELDS; end
|
|
|
|
def validate
|
|
end
|
|
|
|
::Thrift::Struct.generate_accessors self
|
|
end
|
|
|
|
end
|
|
|
|
end
|