class Cassandra::Cluster
Cluster represents a cassandra cluster. It serves as a Session
factory and a collection of metadata.
Inherits
Object
Extends
Forwardable
Methods
host
(address)Find a host by its address
has_host?
(address)Determine if a host by a given address exists
keyspace
(name)Find a keyspace by name
has_keyspace?
(name)Determine if a keyspace by a given name exists
name
Return cluster’s name
find_replicas
(keyspace, statement)Return replicas for a given statement and keyspace
- Note
- an empty list is returned when statement/keyspace information is not enough to determine replica list.
register
(listener)Register a cluster state listener. State listener will start receiving notifications about topology and schema changes
unregister
(listener)Unregister a cluster state listener. State listener will stop receiving notifications about topology and schema changes
each_host
(&block) aliased as: hostsYield or enumerate each member of this cluster
each_keyspace
(&block) aliased as: keyspacesYield or enumerate each keyspace defined in this cluster
connect_async
(keyspace = nil)Asynchronously create a new session, optionally scoped to a keyspace
connect
(keyspace = nil)Synchronously create a new session, optionally scoped to a keyspace
close_async
Asynchronously closes all sessions managed by this cluster
close
Synchronously closes all sessions managed by this cluster
inspect
Returns a CLI-friendly cluster representation