Class: NamespaceStatistics
Overview
rubocop:disable Gitlab/NamespacedClass
Constant Summary
ApplicationRecord::MAX_PLUCK
Class Method Summary
collapse
Instance Method Summary
collapse
#run_after_commit, #run_after_commit_or_now
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Class Method Details
.columns_to_refresh ⇒ Object
45
46
47
|
# File 'app/models/namespace_statistics.rb', line 45
def self.columns_to_refresh
[:dependency_proxy_size]
end
|
Instance Method Details
#refresh!(only: []) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/models/namespace_statistics.rb', line 18
def refresh!(only: [])
return if Gitlab::Database.read_only?
return unless group_namespace?
self.class.columns_to_refresh.each do |column|
if only.empty? || only.include?(column)
public_send("update_#{column}") end
end
save!
end
|
#update_dependency_proxy_size ⇒ Object
39
40
41
42
43
|
# File 'app/models/namespace_statistics.rb', line 39
def update_dependency_proxy_size
return unless group_namespace?
self.dependency_proxy_size = namespace.dependency_proxy_manifests.sum(:size) + namespace.dependency_proxy_blobs.sum(:size)
end
|
#update_storage_size ⇒ Object
31
32
33
34
35
36
37
|
# File 'app/models/namespace_statistics.rb', line 31
def update_storage_size
return unless self.class.database.cached_column_exists?(:dependency_proxy_size)
self.storage_size = dependency_proxy_size
end
|