Class: Cassandra
- Inherits:
-
Object
- Object
- Cassandra
- Defined in:
- lib/cassandra.rb
Instance Attribute Summary collapse
-
#cluster_name ⇒ Object
readonly
Returns the value of attribute cluster_name.
-
#data_path ⇒ Object
readonly
Returns the value of attribute data_path.
-
#node_name ⇒ Object
readonly
Returns the value of attribute node_name.
Instance Method Summary collapse
- #delete_snapshot(_snapshot) ⇒ Object
-
#initialize(config_file, disk_threshold, logger) ⇒ Cassandra
constructor
A new instance of Cassandra.
- #new_snapshot ⇒ Object
Constructor Details
#initialize(config_file, disk_threshold, logger) ⇒ Cassandra
Returns a new instance of Cassandra.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cassandra.rb', line 8 def initialize(config_file, disk_threshold, logger) @logger = logger read_config_file(config_file) @node_name = Socket.gethostname @logger.info("Cassandra cluster name = #{@cluster_name}") @logger.info("Cassandra node name = #{@node_name}") @logger.info("Cassandra data path = #{@data_path}") @disk_threshold = disk_threshold end |
Instance Attribute Details
#cluster_name ⇒ Object (readonly)
Returns the value of attribute cluster_name.
6 7 8 |
# File 'lib/cassandra.rb', line 6 def cluster_name @cluster_name end |
#data_path ⇒ Object (readonly)
Returns the value of attribute data_path.
6 7 8 |
# File 'lib/cassandra.rb', line 6 def data_path @data_path end |
#node_name ⇒ Object (readonly)
Returns the value of attribute node_name.
6 7 8 |
# File 'lib/cassandra.rb', line 6 def node_name @node_name end |
Instance Method Details
#delete_snapshot(_snapshot) ⇒ Object
132 133 134 135 |
# File 'lib/cassandra.rb', line 132 def delete_snapshot(_snapshot) snapname = 'cass_snap' nodetool_clearsnapshot(snapname) end |
#new_snapshot ⇒ Object
122 123 124 125 126 127 128 129 130 |
# File 'lib/cassandra.rb', line 122 def new_snapshot today = Time.new.strftime('%Y_%m_%d') snapname = 'cass_snap' nodetool_snapshot(snapname) = (snapname) CassandraSnapshot.new(@cluster_name, @node_name, today, ) end |