Class: Cassandra

Inherits:
Object
  • Object
show all
Defined in:
lib/cassandra.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameObject (readonly)

Returns the value of attribute cluster_name.


6
7
8
# File 'lib/cassandra.rb', line 6

def cluster_name
  @cluster_name
end

#data_pathObject (readonly)

Returns the value of attribute data_path.


6
7
8
# File 'lib/cassandra.rb', line 6

def data_path
  @data_path
end

#node_nameObject (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_snapshotObject


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