132 lines
2.7 KiB
Ruby
132 lines
2.7 KiB
Ruby
#
|
|
# Autogenerated by Thrift Compiler (0.8.0)
|
|
#
|
|
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
#
|
|
|
|
require 'thrift'
|
|
require 'helloworld_types'
|
|
|
|
module HelloWorld
|
|
class Client
|
|
include ::Thrift::Client
|
|
|
|
def ping()
|
|
send_ping()
|
|
return recv_ping()
|
|
end
|
|
|
|
def send_ping()
|
|
send_message('ping', Ping_args)
|
|
end
|
|
|
|
def recv_ping()
|
|
result = receive_message(Ping_result)
|
|
return result.success unless result.success.nil?
|
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'ping failed: unknown result')
|
|
end
|
|
|
|
def sayHello(msg)
|
|
send_sayHello(msg)
|
|
return recv_sayHello()
|
|
end
|
|
|
|
def send_sayHello(msg)
|
|
send_message('sayHello', SayHello_args, :msg => msg)
|
|
end
|
|
|
|
def recv_sayHello()
|
|
result = receive_message(SayHello_result)
|
|
return result.success unless result.success.nil?
|
|
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'sayHello failed: unknown result')
|
|
end
|
|
|
|
end
|
|
|
|
class Processor
|
|
include ::Thrift::Processor
|
|
|
|
def process_ping(seqid, iprot, oprot)
|
|
args = read_args(iprot, Ping_args)
|
|
result = Ping_result.new()
|
|
result.success = @handler.ping()
|
|
write_result(result, oprot, 'ping', seqid)
|
|
end
|
|
|
|
def process_sayHello(seqid, iprot, oprot)
|
|
args = read_args(iprot, SayHello_args)
|
|
result = SayHello_result.new()
|
|
result.success = @handler.sayHello(args.msg)
|
|
write_result(result, oprot, 'sayHello', seqid)
|
|
end
|
|
|
|
end
|
|
|
|
# HELPER FUNCTIONS AND STRUCTURES
|
|
|
|
class Ping_args
|
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
|
|
FIELDS = {
|
|
|
|
}
|
|
|
|
def struct_fields; FIELDS; end
|
|
|
|
def validate
|
|
end
|
|
|
|
::Thrift::Struct.generate_accessors self
|
|
end
|
|
|
|
class Ping_result
|
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
SUCCESS = 0
|
|
|
|
FIELDS = {
|
|
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
|
}
|
|
|
|
def struct_fields; FIELDS; end
|
|
|
|
def validate
|
|
end
|
|
|
|
::Thrift::Struct.generate_accessors self
|
|
end
|
|
|
|
class SayHello_args
|
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
MSG = 1
|
|
|
|
FIELDS = {
|
|
MSG => {:type => ::Thrift::Types::STRUCT, :name => 'msg', :class => Message}
|
|
}
|
|
|
|
def struct_fields; FIELDS; end
|
|
|
|
def validate
|
|
end
|
|
|
|
::Thrift::Struct.generate_accessors self
|
|
end
|
|
|
|
class SayHello_result
|
|
include ::Thrift::Struct, ::Thrift::Struct_Union
|
|
SUCCESS = 0
|
|
|
|
FIELDS = {
|
|
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
|
|
}
|
|
|
|
def struct_fields; FIELDS; end
|
|
|
|
def validate
|
|
end
|
|
|
|
::Thrift::Struct.generate_accessors self
|
|
end
|
|
|
|
end
|
|
|