Class: Orientdb4r::BinClient
- Defined in:
- lib/orientdb4r/bin/client.rb
Overview
This client implements the binary protocol.
Defined Under Namespace
Classes: Connect, DbOpen, ProtocolString
Constant Summary
Constants inherited from Client
Client::SERVER_VERSION_PATTERN
Instance Attribute Summary
Attributes inherited from Client
#connection_library, #database, #lb_strategy, #load_balancing, #nodes, #password, #proxy, #user
Instance Method Summary collapse
-
#connect(options) ⇒ Object
————————————————————— CONNECTION.
-
#disconnect ⇒ Object
:nodoc:.
-
#initialize(options) ⇒ BinClient
constructor
:nodoc:.
- #server(options = {}) ⇒ Object
Methods inherited from Client
#class_exists?, #command, #connected?, #create_class, #create_database, #create_document, #create_property, #database_exists?, #delete_database, #delete_document, #drop_class, #export, #get_class, #get_database, #get_document, #import, #list_databases, #query, #update_document
Methods included from Utils
#blank?, #compare_versions, #random_string, #verify_and_sanitize_options, #verify_options
Constructor Details
#initialize(options) ⇒ BinClient
:nodoc:
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/orientdb4r/bin/client.rb', line 11 def initialize() #:nodoc: super() = { :host => 'localhost', :port => 2424 } (, ) @host = [:host] @port = [:port] end |
Instance Method Details
#connect(options) ⇒ Object
————————————————————— CONNECTION
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/orientdb4r/bin/client.rb', line 25 def connect #:nodoc: = { :database => :mandatory, :user => :mandatory, :password => :mandatory } (, ) @database = [:database] @user = [:user] @password = [:password] socket = TCPSocket.open(@host, @port) protocol = BinData::Int16be.read(socket) Orientdb4r::logger.info "Binary protocol number: #{protocol}" command = DbOpen.new command.version = protocol command.database = 'temp' command.user = 'admin' command.password = 'admin' command.write(socket) resp = BinData::Int8.read(socket).to_i puts "EE #{resp}" socket.close end |
#disconnect ⇒ Object
:nodoc:
51 52 |
# File 'lib/orientdb4r/bin/client.rb', line 51 def disconnect #:nodoc: end |
#server(options = {}) ⇒ Object
55 56 57 |
# File 'lib/orientdb4r/bin/client.rb', line 55 def server(={}) raise NotImplementedError, 'this should be overridden by concrete client' end |