Skip to content

Commit 4550392

Browse files
committed
RUBY-250 - Expose various cluster attributes via getters in the api.
1 parent c3d9542 commit 4550392

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Features:
99
we are not sure the statement is already prepared. The motivation is that in the steady state, all nodes have
1010
prepared statements already, so there is no need to prepare statements before executing them. If the guess is wrong,
1111
the client will prepare and execute at that point.
12+
* Expose various cluster attributes with getters.
1213

1314
Bug Fixes:
1415
* [RUBY-255](https://datastax-oss.atlassian.net/browse/RUBY-255) ControlConnection.peer_ip ignores peers that are missing critical information in system.peers.

lib/cassandra/cluster.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,21 @@ def each_keyspace(&block)
151151
# @return [Boolean] true or false
152152
def_delegators :@schema, :keyspace, :has_keyspace?
153153

154+
# @return [Integer] Cassandra native protocol port
155+
def port
156+
@connection_options.port
157+
end
158+
159+
# @return [Integer] the version of the native protocol used in communication with nodes
160+
def protocol_version
161+
@connection_options.protocol_version
162+
end
163+
164+
# @return [Hash<String, Cassandra::Execution::Profile>] the collection of execution profiles
165+
def execution_profiles
166+
@profile_manager.profiles
167+
end
168+
154169
# @!method refresh_schema_async
155170
# Trigger an asynchronous schema metadata refresh
156171
# @return [Cassandra::Future<nil>] a future that will be fulfilled when
@@ -279,7 +294,7 @@ def inspect
279294
"name=#{name.inspect}, " \
280295
"port=#{@connection_options.port}, " \
281296
"protocol_version=#{@connection_options.protocol_version}, " \
282-
"profile_manager=#{@profile_manager.inspect}, " \
297+
"execution_profiles=#{@profile_manager.profiles.inspect}, " \
283298
"hosts=#{hosts.inspect}, " \
284299
"keyspaces=#{keyspaces.inspect}>"
285300
end

0 commit comments

Comments
 (0)