Class: BlindIndex::Backfill

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation, batch_size:, columns:) ⇒ Backfill

Returns a new instance of Backfill.



5
6
7
8
9
10
11
# File 'lib/blind_index/backfill.rb', line 5

def initialize(relation, batch_size:, columns:)
  @relation = relation
  @transaction = @relation.respond_to?(:transaction)
  @batch_size = batch_size
  @blind_indexes = @relation.blind_indexes
  filter_columns!(columns) if columns
end

Instance Attribute Details

#blind_indexesObject (readonly)

Returns the value of attribute blind_indexes.



3
4
5
# File 'lib/blind_index/backfill.rb', line 3

def blind_indexes
  @blind_indexes
end

Instance Method Details

#performObject



13
14
15
16
17
# File 'lib/blind_index/backfill.rb', line 13

def perform
  each_batch do |records|
    backfill_records(records)
  end
end