#
# Autogenerated by Thrift Compiler (0.8.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

require 'thrift'
require 'state_store_subscriber_service_types'

module Impala
  module Protocol
    module StateStoreSubscriberService
      class Client
        include ::Thrift::Client

        def UpdateState(request)
          send_UpdateState(request)
          return recv_UpdateState()
        end

        def send_UpdateState(request)
          send_message('UpdateState', UpdateState_args, :request => request)
        end

        def recv_UpdateState()
          result = receive_message(UpdateState_result)
          return result.success unless result.success.nil?
          raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'UpdateState failed: unknown result')
        end

      end

      class Processor
        include ::Thrift::Processor

        def process_UpdateState(seqid, iprot, oprot)
          args = read_args(iprot, UpdateState_args)
          result = UpdateState_result.new()
          result.success = @handler.UpdateState(args.request)
          write_result(result, oprot, 'UpdateState', seqid)
        end

      end

      # HELPER FUNCTIONS AND STRUCTURES

      class UpdateState_args
        include ::Thrift::Struct, ::Thrift::Struct_Union
        REQUEST = 1

        FIELDS = {
        REQUEST => { :type => ::Thrift::Types::STRUCT, :name => 'request', :class => Impala::Protocol::TUpdateStateRequest }
        }

        def struct_fields; FIELDS; end

        def validate
        end

        ::Thrift::Struct.generate_accessors self
      end

      class UpdateState_result
        include ::Thrift::Struct, ::Thrift::Struct_Union
        SUCCESS = 0

        FIELDS = {
        SUCCESS => { :type => ::Thrift::Types::STRUCT, :name => 'success', :class => Impala::Protocol::TUpdateStateResponse }
        }

        def struct_fields; FIELDS; end

        def validate
        end

        ::Thrift::Struct.generate_accessors self
      end

    end

  end
end
