class Cassandra::Host
Attributes
@note This is the public IP address of the host if the cluster is deployed across multiple Amazon EC2 regions
(or equivalently multiple networks). Cassandra nodes in other EC2 regions use this address to connect to this host.
@return [IPAddr, String] broadcast address, if available.
@note Host
datacenter can be `nil` before cluster has connected. @return [String, nil] host datacenter
@note Host
id can be `nil` before cluster has connected. @return [Cassandra::Uuid, nil] host id.
@return [IPAddr] host ip that clients use to connect to this host.
@note This is the address that other Cassandra
nodes use to connect to this host. @return [IPAddr, String] listen address, if available.
@note Host
rack can be `nil` before cluster has connected. @return [String, nil] host rack
@note Host's cassandra version can be `nil` before cluster has connected. @return [String, nil] version of cassandra that a host is running
@return [Symbol] host status. Must be `:up` or `:down`
@note Host
tokens will be empty before cluster has connected. @return [Array<String>] a list of tokens owned by this host
Public Class Methods
@private
# File lib/cassandra/host.rb 50 def initialize(ip, 51 id = nil, 52 rack = nil, 53 datacenter = nil, 54 release_version = nil, 55 tokens = EMPTY_LIST, 56 status = :up, 57 broadcast_address = nil, 58 listen_address = nil) 59 @ip = ip 60 @id = id 61 @rack = rack 62 @datacenter = datacenter 63 @release_version = release_version 64 @tokens = tokens 65 @status = status 66 @broadcast_address = broadcast_address.is_a?(String) ? 67 ::IPAddr.new(broadcast_address) : broadcast_address 68 @listen_address = listen_address.is_a?(String) ? 69 ::IPAddr.new(listen_address) : listen_address 70 end
Public Instance Methods
@return [Boolean] whether this host's status is `:down`
# File lib/cassandra/host.rb 78 def down? 79 @status == :down 80 end
@private
# File lib/cassandra/host.rb 92 def eql?(other) 93 other.eql?(@ip) 94 end
@private
# File lib/cassandra/host.rb 83 def hash 84 @hash ||= begin 85 h = 17 86 h = 31 * h + @ip.hash 87 h 88 end 89 end
@private
# File lib/cassandra/host.rb 98 def inspect 99 "#<#{self.class.name}:0x#{object_id.to_s(16)} @ip=#{@ip}>" 100 end
@return [Boolean] whether this host's status is `:up`
# File lib/cassandra/host.rb 73 def up? 74 @status == :up 75 end