Class: Arango::Server

Inherits:
Object
  • Object
show all
Includes:
Helper::Satisfaction, Administration, Databases, Monitoring, OpalSupport, Tasks
Defined in:
lib/arango/server.rb,
lib/arango/server/user.rb,
lib/arango/server/async.rb,
lib/arango/server/tasks.rb,
lib/arango/server/agency.rb,
lib/arango/server/databases.rb,
lib/arango/server/monitoring.rb,
lib/arango/server/opal_support.rb,
lib/arango/server/administration.rb

Overview

Arango Server

Defined Under Namespace

Modules: Administration, Agency, Async, Databases, Monitoring, OpalSupport, Tasks, User

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OpalSupport

#install_opal_module

Methods included from Tasks

#all_tasks, #create_task, #drop_task, #get_task, #list_tasks, #new_task, #task_exists?

Methods included from Monitoring

#cluster_health, #cluster_statistics

Methods included from Databases

#all_databases, #all_user_databases, #create_database, #database_exists?, #delete_database, #get_database, #list_databases, #list_user_databases, #new_database

Methods included from Administration

#agent?, #available?, #cluster_endpoints, #coordinator?, #detailed_version, #echo, #endpoints, #engine, #enterprise?, #flush_wal, #in_cluster?, #log, #log_level, #log_level=, #mmfiles?, #mode, #mode=, #primary?, #read_only?, #reload_routing, #rocksdb?, #role, #secondary?, #server_id, #shutdown, #single?, #statistics, #statistics_description, #status, #target_version, #time, #version, #wal_properties, #wal_properties=

Methods included from Helper::Satisfaction

#satisfy_category?, #satisfy_class?, #satisfy_class_or_string?, #satisfy_module?, #satisfy_module_or_nil?, #satisfy_module_or_string?, #warning_deprecated

Constructor Details

#initialize(username: "root", password:, host: "localhost", port: "8529", tls: false, driver_options: nil) ⇒ Arango::Server

Connect to a ArangoDB server.

Parameters:

  • username (String) (defaults to: "root")
  • password (String)
  • host (String) (defaults to: "localhost")
  • port (String) (defaults to: "8529")
  • tls (Boolean) (defaults to: false)

    Use TLS for the connection, optional, default: false.



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/arango/server.rb', line 23

def initialize(username: "root", password:, host: "localhost", port: "8529", tls: false, driver_options: nil)
  @host = host
  @port = port
  @tls = tls
  @username = username
  @base_uri = "http"
  @base_uri += "s" if tls
  @base_uri += "://#{host}:#{port}"
  options = { username: username, password: password }
  driver_options = {} unless driver_options
  @driver_instance = Arango.driver.new(base_uri: base_uri, options: driver_options.merge(options))
end

Instance Attribute Details

#asyncObject (readonly)

Returns the value of attribute async.



13
14
15
# File 'lib/arango/server.rb', line 13

def async
  @async
end

#base_uriObject (readonly)

Returns the value of attribute base_uri.



13
14
15
# File 'lib/arango/server.rb', line 13

def base_uri
  @base_uri
end

#current_databaseObject

Returns the value of attribute current_database.



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

def current_database
  @current_database
end

#driver_instanceObject (readonly)

Returns the value of attribute driver_instance.



13
14
15
# File 'lib/arango/server.rb', line 13

def driver_instance
  @driver_instance
end

#hostObject (readonly)

Returns the value of attribute host.



13
14
15
# File 'lib/arango/server.rb', line 13

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



13
14
15
# File 'lib/arango/server.rb', line 13

def port
  @port
end

#tlsObject (readonly)

Returns the value of attribute tls.



13
14
15
# File 'lib/arango/server.rb', line 13

def tls
  @tls
end

#usernameObject (readonly)

Returns the value of attribute username.



13
14
15
# File 'lib/arango/server.rb', line 13

def username
  @username
end

Instance Method Details

#endpointObject



36
37
38
# File 'lib/arango/server.rb', line 36

def endpoint
  "tcp://#{@host}:#{@port}"
end

#transactionsArango::Result

Returns information about the currently running transactions.

Returns:



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

def transactions
  Arango::Requests::Wal::Transactions.execute(server: self)
end

#transactions_running?Boolean

Check if transactions are running on server.

Returns:

  • (Boolean)


48
49
50
# File 'lib/arango/server.rb', line 48

def transactions_running?
  transactions.running_transactions > 0
end