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:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/workers/concerns
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/workers/concerns')
-rw-r--r--app/workers/concerns/update_repository_storage_worker.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/app/workers/concerns/update_repository_storage_worker.rb b/app/workers/concerns/update_repository_storage_worker.rb
new file mode 100644
index 00000000000..f46b64895a2
--- /dev/null
+++ b/app/workers/concerns/update_repository_storage_worker.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+module UpdateRepositoryStorageWorker
+ extend ActiveSupport::Concern
+ include ApplicationWorker
+
+ included do
+ idempotent!
+ feature_category :gitaly
+ urgency :throttled
+ end
+
+ def perform(container_id, new_repository_storage_key, repository_storage_move_id = nil)
+ repository_storage_move =
+ if repository_storage_move_id
+ find_repository_storage_move(repository_storage_move_id)
+ else
+ # maintain compatibility with workers queued before release
+ container = find_container(container_id)
+ container.repository_storage_moves.create!(
+ source_storage_name: container.repository_storage,
+ destination_storage_name: new_repository_storage_key
+ )
+ end
+
+ update_repository_storage(repository_storage_move)
+ end
+
+ private
+
+ def find_repository_storage_move(repository_storage_move_id)
+ raise NotImplementedError
+ end
+
+ def find_container(container_id)
+ raise NotImplementedError
+ end
+
+ def update_repository_storage(repository_storage_move)
+ raise NotImplementedError
+ end
+end