View Source Xandra.Cluster.Host (Xandra v0.18.0)
The data structure to represent a host in a Cassandra cluster.
The fields of this struct are public. See t/0
for information on their type,
and %Xandra.Cluster.Host{}
for more information.
Summary
Functions
The struct that represents a host in a Cassandra cluster.
Formats a host's address and port as a string.
Types
@type t() :: %Xandra.Cluster.Host{ address: :inet.ip_address() | String.t(), data_center: String.t(), host_id: String.t(), port: :inet.port_number(), rack: String.t(), release_version: String.t(), schema_version: String.t(), tokens: MapSet.t(String.t()) }
The type for the host struct.
Fields
:address
- the address of the host. It can be either an IP address or a hostname. If Xandra managed to connect to this host, then the:address
will be the actual IP peer (see:inet.peername/1
). Otherwise, the:address
will be the parsed IP or the charlist hostname. For example, if you pass"10.0.2.1"
as the address, Xandra will normalize it to{10, 0, 2, 1}
.:port
- the port of the host.:data_center
- the data center of the host, as found in thesystem.local
orsystem.peers
table.:host_id
- the ID of the host, as found in thesystem.local
orsystem.peers
table.:rack
- the rack of the host, as found in thesystem.local
orsystem.peers
table.:release_version
- the release version of the host, as found in thesystem.local
orsystem.peers
table.:schema_version
- the schema version of the host, as found in thesystem.local
orsystem.peers
table.:tokens
- the tokens held by the host, as found in thesystem.local
orsystem.peers
table.
Functions
The struct that represents a host in a Cassandra cluster.
See t/0
for the type of each field.
Formats a host's address and port as a string.
Examples
iex> host = %Xandra.Cluster.Host{address: {127, 0, 0, 1}, port: 9042}
iex> Xandra.Cluster.Host.format_address(host)
"127.0.0.1:9042"
iex> host = %Xandra.Cluster.Host{address: "example.com", port: 9042}
iex> Xandra.Cluster.Host.format_address(host)
"example.com:9042"