Class: Cassandra::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/cassandra/host.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#datacenterString? (readonly)

Note:

Host datacenter can be nil before cluster has connected.

Returns host datacenter.

Returns:

  • (String, nil)

    host datacenter



28
29
30
# File 'lib/cassandra/host.rb', line 28

def datacenter
  @datacenter
end

#idCassandra::Uuid? (readonly)

Note:

Host id can be nil before cluster has connected.

Returns host id.

Returns:



25
26
27
# File 'lib/cassandra/host.rb', line 25

def id
  @id
end

#ipIPAddr (readonly)

Returns host ip.

Returns:

  • (IPAddr)

    host ip



22
23
24
# File 'lib/cassandra/host.rb', line 22

def ip
  @ip
end

#rackString? (readonly)

Note:

Host rack can be nil before cluster has connected.

Returns host rack.

Returns:

  • (String, nil)

    host rack



31
32
33
# File 'lib/cassandra/host.rb', line 31

def rack
  @rack
end

#release_versionString? (readonly)

Note:

Host's cassandra version can be nil before cluster has connected.

Returns version of cassandra that a host is running.

Returns:

  • (String, nil)

    version of cassandra that a host is running



34
35
36
# File 'lib/cassandra/host.rb', line 34

def release_version
  @release_version
end

#statusSymbol (readonly)

Returns host status. Must be :up or :down.

Returns:

  • (Symbol)

    host status. Must be :up or :down



39
40
41
# File 'lib/cassandra/host.rb', line 39

def status
  @status
end

#tokensArray<String> (readonly)

Note:

Host tokens will be empty before cluster has connected.

Returns a list of tokens owned by this host.

Returns:

  • (Array<String>)

    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.

Returns:

  • (Boolean)

    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.

Parameters:

Returns:

  • (Boolean)

    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

#inspectString

Returns a CLI-friendly host representation.

Returns:

  • (String)

    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.

Returns:

  • (Boolean)

    whether this host's status is :up



53
54
55
# File 'lib/cassandra/host.rb', line 53

def up?
  @status == :up
end