Class: Cassandra::Host
- Inherits:
-
Object
- Object
- Cassandra::Host
- Defined in:
- lib/cassandra/host.rb
Instance Attribute Summary collapse
-
#datacenter ⇒ String?
readonly
Host datacenter.
-
#id ⇒ Cassandra::Uuid?
readonly
Host id.
-
#ip ⇒ IPAddr
readonly
Host ip.
-
#rack ⇒ String?
readonly
Host rack.
-
#release_version ⇒ String?
readonly
Version of cassandra that a host is running.
-
#status ⇒ Symbol
readonly
Host status.
-
#tokens ⇒ Array<String>
readonly
A list of tokens owned by this host.
Instance Method Summary collapse
-
#down? ⇒ Boolean
Whether this host's status is
:down
. -
#eql?(other) ⇒ Boolean
(also: #==)
Whether this host has the same ip as the other.
-
#inspect ⇒ String
A CLI-friendly host representation.
-
#up? ⇒ Boolean
Whether this host's status is
:up
.
Instance Attribute Details
#datacenter ⇒ String? (readonly)
Host datacenter can be nil
before cluster has connected.
Returns host datacenter.
28 29 30 |
# File 'lib/cassandra/host.rb', line 28 def datacenter @datacenter end |
#id ⇒ Cassandra::Uuid? (readonly)
Host id can be nil
before cluster has connected.
Returns host id.
25 26 27 |
# File 'lib/cassandra/host.rb', line 25 def id @id end |
#ip ⇒ IPAddr (readonly)
Returns host ip.
22 23 24 |
# File 'lib/cassandra/host.rb', line 22 def ip @ip end |
#rack ⇒ String? (readonly)
Host rack can be nil
before cluster has connected.
Returns host rack.
31 32 33 |
# File 'lib/cassandra/host.rb', line 31 def rack @rack end |
#release_version ⇒ String? (readonly)
Host's cassandra version can be nil
before cluster has connected.
Returns version of cassandra that a host is running.
34 35 36 |
# File 'lib/cassandra/host.rb', line 34 def release_version @release_version end |
#status ⇒ Symbol (readonly)
Returns host status. Must be :up
or :down
.
39 40 41 |
# File 'lib/cassandra/host.rb', line 39 def status @status end |
#tokens ⇒ Array<String> (readonly)
Host tokens will be empty before cluster has connected.
Returns a list of tokens owned by this host.
37 38 39 |
# File 'lib/cassandra/host.rb', line 37 def tokens @tokens end |
Instance Method Details
#down? ⇒ Boolean
Returns whether this host's status is :down
.
58 59 60 |
# File 'lib/cassandra/host.rb', line 58 def down? @status == :down end |
#eql?(other) ⇒ Boolean Also known as: ==
Returns whether this host has the same ip as the other.
69 70 71 |
# File 'lib/cassandra/host.rb', line 69 def eql?(other) other.eql?(@ip) end |
#inspect ⇒ String
Returns a CLI-friendly host representation.
75 76 77 |
# File 'lib/cassandra/host.rb', line 75 def inspect "#<#{self.class.name}:0x#{self.object_id.to_s(16)} @ip=#{@ip}>" end |
#up? ⇒ Boolean
Returns whether this host's status is :up
.
53 54 55 |
# File 'lib/cassandra/host.rb', line 53 def up? @status == :up end |