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

repository_file_uploader.rb « rpm « packages « uploaders « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ff7e2bc719a3dfa0eade484671b83fccf52b2905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true
module Packages
  module Rpm
    class RepositoryFileUploader < GitlabUploader
      include ObjectStorage::Concern

      storage_options Gitlab.config.packages

      after :store, :schedule_background_upload

      alias_method :upload, :model

      def filename
        model.file_name
      end

      def store_dir
        dynamic_segment
      end

      private

      def dynamic_segment
        raise ObjectNotReadyError, 'Repository file model not ready' unless model.id

        Gitlab::HashedPath.new(
          'projects', model.project_id, 'rpm', 'repository_files', model.id,
          root_hash: model.project_id
        )
      end
    end
  end
end