Class: Orientdb4r::Node

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/orientdb4r/node.rb

Overview

This class represents a single sever/node in the Distributed Multi-Master Architecture.

Direct Known Subclasses

RestNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#blank?, #compare_versions, #random_string, #verify_and_sanitize_options, #verify_options

Constructor Details

#initialize(host, port) ⇒ Node

Constructor.

Raises:

  • (ArgumentError)


14
15
16
17
18
19
# File 'lib/orientdb4r/node.rb', line 14

def initialize(host, port)
  raise ArgumentError, 'host cannot be blank' if blank? host
  raise ArgumentError, 'port cannot be blank' if blank? port
  @host = host
  @port = port
end

Instance Attribute Details

#hostObject (readonly)

they are immutable



9
10
11
# File 'lib/orientdb4r/node.rb', line 9

def host
  @host
end

#portObject (readonly)

they are immutable



9
10
11
# File 'lib/orientdb4r/node.rb', line 9

def port
  @port
end

#session_idObject (readonly)

Returns the value of attribute session_id.



10
11
12
# File 'lib/orientdb4r/node.rb', line 10

def session_id
  @session_id
end

Instance Method Details

#cleanupObject

Cleans up resources used by the node.



24
25
26
# File 'lib/orientdb4r/node.rb', line 24

def cleanup
  @session_id = nil
end

#to_sObject

:nodoc:



36
37
38
# File 'lib/orientdb4r/node.rb', line 36

def to_s  #:nodoc:
  "Node(host=#{host},port=#{port})"
end

#urlObject

Gets URL of the remote node.

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/orientdb4r/node.rb', line 31

def url
  raise NotImplementedError, 'this should be overridden by subclass'
end