Class: ActiveRecord::Materialized::IncrementalRefresh Private

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

Runs one incremental-maintenance pass for a view, choosing the summary-delta or scoped-recompute path from the pending maintenance and annotating the refresh instrumentation payload with the mode and partitions it touched.

Instance Method Summary collapse

Constructor Details

#initialize(view_class, payload) ⇒ IncrementalRefresh

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



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

def initialize(view_class, payload)
  @view_class = view_class
  @payload = payload
end

Instance Method Details

#callObject

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
22
23
# File 'lib/activerecord/materialized/incremental_refresh.rb', line 16

def call
  ensure_cache_table!
  store = MaintenanceStore.new(@view_class)
  pending = store.pending
  @payload[:mode] = mode(pending)
  @payload[:partition_count] = partition_count(pending)
  apply!(store, pending)
end