Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/cache/metadata.rb')
-rw-r--r--lib/gitlab/cache/metadata.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/gitlab/cache/metadata.rb b/lib/gitlab/cache/metadata.rb
index d6c89b5b2c3..224f215ef82 100644
--- a/lib/gitlab/cache/metadata.rb
+++ b/lib/gitlab/cache/metadata.rb
@@ -5,13 +5,18 @@ module Gitlab
# Value object for cache metadata
class Metadata
VALID_BACKING_RESOURCES = [:cpu, :database, :gitaly, :memory, :unknown].freeze
- DEFAULT_BACKING_RESOURCE = :unknown
+ # @param cache_identifier [String] defines the location of the cache definition
+ # Example: "ProtectedBranches::CacheService#fetch"
+ # @param feature_category [Symbol] name of the feature category (from config/feature_categories.yml)
+ # @param caller_id [String] caller id from labkit context
+ # @param backing_resource [Symbol] most affected resource by cache generation (full list: VALID_BACKING_RESOURCES)
+ # @return [Gitlab::Cache::Metadata]
def initialize(
cache_identifier:,
feature_category:,
caller_id: Gitlab::ApplicationContext.current_context_attribute(:caller_id),
- backing_resource: DEFAULT_BACKING_RESOURCE
+ backing_resource: Client::DEFAULT_BACKING_RESOURCE
)
@cache_identifier = cache_identifier
@feature_category = Gitlab::FeatureCategories.default.get!(feature_category)
@@ -28,7 +33,7 @@ module Gitlab
raise "Unknown backing resource: #{resource}" if Gitlab.dev_or_test_env?
- DEFAULT_BACKING_RESOURCE
+ Client::DEFAULT_BACKING_RESOURCE
end
end
end