debian-mirror-gitlab/app/uploaders/packages/composer/cache_uploader.rb

25 lines
505 B
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
class Packages::Composer::CacheUploader < GitlabUploader
include ObjectStorage::Concern
2023-05-27 22:25:52 +05:30
storage_location :packages
2021-03-11 19:13:27 +05:30
alias_method :upload, :model
def filename
"#{model.file_sha256}.json"
end
def store_dir
dynamic_segment
end
private
def dynamic_segment
raise ObjectNotReadyError, 'Package model not ready' unless model.id
Gitlab::HashedPath.new("packages", "composer_cache", model.namespace_id, root_hash: model.namespace_id)
end
end