Class: ActiveRecord::Materialized::WriteMaintenance Private

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord/materialized/write_maintenance.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.

Translates a committed dependency write into a view's pending maintenance — a summary delta on a warm delta-maintainable view, otherwise a scoped (or, when the partition key cannot be derived, widened) recompute — and emits the maintenance instrumentation event for the path taken.

Instance Method Summary collapse

Constructor Details

#initialize(view_class) ⇒ WriteMaintenance

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 WriteMaintenance.



12
13
14
# File 'lib/activerecord/materialized/write_maintenance.rb', line 12

def initialize(view_class)
  @view_class = view_class
end

Instance Method Details

#record!(change) ⇒ 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.



16
17
18
19
20
21
# File 'lib/activerecord/materialized/write_maintenance.rb', line 16

def record!(change)
  return record_summary_delta!(change) if @view_class.delta_maintaining?
  return unless @view_class.incrementally_maintainable?

  record_scoped_recompute!(change)
end