Class: ActiveRecord::Materialized::IncrementalMaintainer Private
- Inherits:
-
Object
- Object
- ActiveRecord::Materialized::IncrementalMaintainer
- Extended by:
- T::Sig
- Defined in:
- lib/activerecord/materialized/incremental_maintainer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Hot-path scoped recompute: deletes and re-aggregates only the affected partitions in place.
Instance Method Summary collapse
-
#initialize(view_class) ⇒ IncrementalMaintainer
constructor
private
A new instance of IncrementalMaintainer.
- #maintain!(_connection, _table_name) ⇒ Object private
Constructor Details
#initialize(view_class) ⇒ IncrementalMaintainer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of IncrementalMaintainer.
13 14 15 |
# File 'lib/activerecord/materialized/incremental_maintainer.rb', line 13 def initialize(view_class) @view_class = view_class end |
Instance Method Details
#maintain!(_connection, _table_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/activerecord/materialized/incremental_maintainer.rb', line 18 def maintain!(_connection, _table_name) delta = maintenance_store.consume_pending_delta! relation = resolve_maintenance_relation(delta) row_count = RelationCacheWriter.new(view_class).replace_partitions!( relation, key_tuples: delta.key_tuples, full_partition: delta.full_partition? ) # On a cold view the maintained partitions are now fresh. unless delta.full_partition? || view_class.materialized? PartitionState.new(view_class).mark_fresh!(delta.key_tuples) end row_count end |