Class: BlindIndex::Backfill
- Inherits:
-
Object
- Object
- BlindIndex::Backfill
- Defined in:
- lib/blind_index/backfill.rb
Instance Attribute Summary collapse
-
#blind_indexes ⇒ Object
readonly
Returns the value of attribute blind_indexes.
Instance Method Summary collapse
-
#initialize(relation, batch_size:, columns:) ⇒ Backfill
constructor
A new instance of Backfill.
- #perform ⇒ Object
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) && !mongoid_relation?(relation.all) @batch_size = batch_size @blind_indexes = @relation.blind_indexes filter_columns!(columns) if columns end |
Instance Attribute Details
#blind_indexes ⇒ Object (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
#perform ⇒ Object
13 14 15 16 17 |
# File 'lib/blind_index/backfill.rb', line 13 def perform each_batch do |records| backfill_records(records) end end |