Class: OrientdbBinary::Server

Inherits:
OrientdbBase show all
Defined in:
lib/orientdb_binary/server.rb

Instance Attribute Summary

Attributes inherited from OrientdbBase

#protocol, #session, #socket

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OrientdbBase

#close, #connected?, #disconnect, #initialize

Constructor Details

This class inherits a constructor from OrientdbBinary::OrientdbBase

Class Method Details

.connect(options) ⇒ Object



14
15
16
# File 'lib/orientdb_binary/server.rb', line 14

def self.connect(options)
  Server.new(options)
end

Instance Method Details

#config_listObject



62
63
64
# File 'lib/orientdb_binary/server.rb', line 62

def config_list
  OrientdbBinary::Protocols::ConfigList.new(session: session).process(socket)
end

#connect(args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/orientdb_binary/server.rb', line 18

def connect(args)
  connection = OrientdbBinary::Protocols::Connect.new(
                                                        protocol: protocol,
                                                        user: args[:user],
                                                        password: args[:password]
                                                      ).process(socket)
  @session = connection[:session] || OrientdbBinary::OperationTypes::NEW_SESSION
  @connected = true if @session > OrientdbBinary::OperationTypes::NEW_SESSION
  connection
end

#db_create(name, type, storage) ⇒ Object



34
35
36
# File 'lib/orientdb_binary/server.rb', line 34

def db_create(name, type, storage)
  OrientdbBinary::Protocols::DbCreate.new(session: session, name: name, type: type, storage: storage).process(socket)
end

#db_drop(name, storage) ⇒ Object



38
39
40
# File 'lib/orientdb_binary/server.rb', line 38

def db_drop(name, storage)
  OrientdbBinary::Protocols::DbDrop.new(session: session, name: name, storage: storage).process(socket)
end

#db_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
# File 'lib/orientdb_binary/server.rb', line 29

def db_exists?(name)
  answer = OrientdbBinary::Protocols::DbExist.new(session: session, database: name).process(socket)
  answer[:exists] == 1
end

#db_freeze(name, storage) ⇒ Object



46
47
48
# File 'lib/orientdb_binary/server.rb', line 46

def db_freeze(name, storage)
  OrientdbBinary::Protocols::DbFreeze.new(session: session, name: name, storage: storage).process(socket)
end

#db_release(name, storage) ⇒ Object



50
51
52
# File 'lib/orientdb_binary/server.rb', line 50

def db_release(name, storage)
  OrientdbBinary::Protocols::DbRelease.new(session: session, name: name, storage: storage).process(socket)
end

#get_config(key) ⇒ Object



54
55
56
# File 'lib/orientdb_binary/server.rb', line 54

def get_config(key)
  OrientdbBinary::Protocols::ConfigGet.new(session: session, option_key: key).process(socket)
end

#listObject



42
43
44
# File 'lib/orientdb_binary/server.rb', line 42

def list
  OrientdbBinary::Protocols::DbList.new(session: session).process(socket).process
end

#set_config(key, value) ⇒ Object



58
59
60
# File 'lib/orientdb_binary/server.rb', line 58

def set_config(key, value)
  OrientdbBinary::Protocols::ConfigSet.new(session: session, option_key: key.to_s, option_value: value.to_s).process(socket)
end

#shutdownObject



66
67
68
# File 'lib/orientdb_binary/server.rb', line 66

def shutdown
  OrientdbBinary::Protocols::Shutdown.new(session: session, user: @options[:user], password: @options[:password]).process(socket)
end