Class: CassandraModel::RotatingTable

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cassandra_model/rotating_table.rb

Instance Method Summary collapse

Constructor Details

#initialize(tables, schedule) ⇒ RotatingTable

Returns a new instance of RotatingTable.



8
9
10
11
12
13
14
# File 'lib/cassandra_model/rotating_table.rb', line 8

def initialize(tables, schedule)
  columns = tables.first.columns
  raise 'RotatingTable, Table columns do not match' unless valid_tables?(columns, tables)

  @tables = tables
  @schedule = schedule
end

Instance Method Details

#==(rhs) ⇒ Object



24
25
26
27
# File 'lib/cassandra_model/rotating_table.rb', line 24

def ==(rhs)
  @schedule == rhs.schedule &&
      @tables == rhs.tables
end

#allow_truncation!Object



16
17
18
# File 'lib/cassandra_model/rotating_table.rb', line 16

def allow_truncation!
  tables.each(&:allow_truncation!)
end

#reset_local_schema!Object



20
21
22
# File 'lib/cassandra_model/rotating_table.rb', line 20

def reset_local_schema!
  @tables.reject { |table| table.is_a?(MetaTable) }.each(&:reset_local_schema!)
end