Module: OrientdbBinary::DatabaseOperations::BaseOperations
- Included in:
- OrientdbBinary::Database
- Defined in:
- lib/orientdb_binary/database_operations/base_operations.rb
Instance Method Summary collapse
-
#close ⇒ Object
Close databse connection No params are accepted Usage: db.close().
-
#open(args) ⇒ Object
Open database connection.
-
#reload ⇒ Object
Reload database.
-
#size ⇒ Object
Return size of the database No params are accepted Usage: db.size().
Instance Method Details
#close ⇒ Object
Close databse connection No params are accepted Usage: db.close()
44 45 46 47 |
# File 'lib/orientdb_binary/database_operations/base_operations.rb', line 44 def close OrientdbBinary::Protocols::DbClose.new(params).process(socket) super end |
#open(args) ⇒ Object
Open database connection. Params: db: string -> database name user: username for accessing database password: user’s pasword for database access storage: string -> memory, local, plocal; plocal is used by default Usage: db = OrientdbBinary::Database.open(db: “test”, storage: ‘plocal’, user: ‘admin’, password: ‘admin’)
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/orientdb_binary/database_operations/base_operations.rb', line 20 def open(args) @db_params = { db: args[:db], storage: args[:storage] } defaults = { storage: 'plocal' } connection = OrientdbBinary::Protocols::DbOpen.new(defaults.merge(args)).process(socket) @session = connection[:session] @connected = true if @session >= 0 @clusters = connection[:clusters] connection end |
#reload ⇒ Object
Reload database. Information about clusters are updated No params are accepted Usage db.reload()
54 55 56 57 58 |
# File 'lib/orientdb_binary/database_operations/base_operations.rb', line 54 def reload answer = OrientdbBinary::Protocols::DbReload.new(params).process(socket) @clusters = answer[:clusters] answer end |
#size ⇒ Object
Return size of the database No params are accepted Usage: db.size()
65 66 67 |
# File 'lib/orientdb_binary/database_operations/base_operations.rb', line 65 def size OrientdbBinary::Protocols::DbSize.new(params).process(socket) end |