Class: ActiveRecord::Materialized::IncrementalMaintainer Private

Inherits:
Object
  • Object
show all
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

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.



9
10
11
# File 'lib/activerecord/materialized/incremental_maintainer.rb', line 9

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.



13
14
15
16
17
18
# File 'lib/activerecord/materialized/incremental_maintainer.rb', line 13

def maintain!(_connection, _table_name)
  delta = maintenance_store.consume_pending_delta!
  return view_class.unscoped.count if delta.nil? # another cross-process cycle consumed it — no-op

  apply_delta!(delta)
end