class Orientdb4r::BinClient

This client implements the binary protocol.

Public Instance Methods

server(options={}) click to toggle source
# File lib/orientdb4r/bin/client.rb, line 66
def server(options={})
  raise NotImplementedError, 'this should be overridden by concrete client'
end

Private Instance Methods

params(args = {}) click to toggle source

Gets a hash of parameters.

# File lib/orientdb4r/bin/client.rb, line 105
def params(args = {})
  args.merge({ session: connection.session })
end
raise_response_error(socket) click to toggle source
# File lib/orientdb4r/bin/client.rb, line 113
def raise_response_error(socket)
  session = read_integer(socket)
  exceptions = []

  while (result = read_byte(socket)) == Status::ERROR
    exceptions << {
      :exception_class => read_string(socket),
      :exception_message => read_string(socket)
    }
  end

  Orientdb4r::logger.error "exception(s): #{exceptions}"

  # if exceptions[0] && exceptions[0][:exception_class] == "com.orientechnologies.orient.core.exception.ORecordNotFoundException"
  #   raise RecordNotFound.new(session)
  # else
  #  raise ServerError.new(session, *exceptions)
  # end
end
read_byte(socket) click to toggle source
# File lib/orientdb4r/bin/client.rb, line 135
def read_byte(socket)
  BinData::Int8.read(socket).to_i
end
read_integer(socket) click to toggle source
# File lib/orientdb4r/bin/client.rb, line 132
def read_integer(socket)
  BinData::Int32be.read(socket).to_i
end
read_response(socket) click to toggle source
# File lib/orientdb4r/bin/client.rb, line 109
def read_response(socket)
  result = BinData::Int8.read(socket).to_i
  raise_response_error(socket) unless result == Status::OK
end