Class: CassandraModel::RotatingTable

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

Instance Method Summary collapse

Methods included from TableDebug

#debug

Constructor Details

#initialize(tables, schedule) ⇒ RotatingTable

Returns a new instance of RotatingTable.



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

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



26
27
28
29
# File 'lib/cassandra_model/rotating_table.rb', line 26

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

#allow_truncation!Object



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

def allow_truncation!
  @allow_truncation = true
  tables.each(&:allow_truncation!)
end

#reset_local_schema!Object



22
23
24
# File 'lib/cassandra_model/rotating_table.rb', line 22

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