Class: ActiveRecord::Materialized::Registry Private

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/activerecord/materialized/registry.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.

Tracks every defined view class and provides bulk operations (refresh / rebuild / warm-up / verify) across all of them.

Class Method Summary collapse

Class Method Details

.allObject

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.



35
36
37
# File 'lib/activerecord/materialized/registry.rb', line 35

def all
  views.values
end

.find(key) ⇒ 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.



25
26
27
# File 'lib/activerecord/materialized/registry.rb', line 25

def find(key)
  views[key.to_s]
end

.for_class_name(class_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.



30
31
32
# File 'lib/activerecord/materialized/registry.rb', line 30

def for_class_name(class_name)
  all.find { |view| view.name == class_name }
end

.rebuild_all!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.



51
52
53
# File 'lib/activerecord/materialized/registry.rb', line 51

def rebuild_all!
  all.map { |view| view.rebuild!(confirm: true) }
end

.refresh_all!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.



41
42
43
# File 'lib/activerecord/materialized/registry.rb', line 41

def refresh_all!
  all.map(&:refresh!)
end

.refresh_stale!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.



46
47
48
# File 'lib/activerecord/materialized/registry.rb', line 46

def refresh_stale!
  all.select(&:stale?).map(&:refresh!)
end

.register(view_class) ⇒ 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.



15
16
17
# File 'lib/activerecord/materialized/registry.rb', line 15

def register(view_class)
  views[view_class.view_key] = view_class
end

.reset!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.



61
62
63
# File 'lib/activerecord/materialized/registry.rb', line 61

def reset!
  @views = {}
end

.unregister(view_class) ⇒ 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.



20
21
22
# File 'lib/activerecord/materialized/registry.rb', line 20

def unregister(view_class)
  views.delete(view_class.view_key)
end

.warm_up_all!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.



56
57
58
# File 'lib/activerecord/materialized/registry.rb', line 56

def warm_up_all!
  all.map(&:warm_up!)
end