diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/services/snippets | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/services/snippets')
-rw-r--r-- | app/services/snippets/schedule_bulk_repository_shard_moves_service.rb | 31 | ||||
-rw-r--r-- | app/services/snippets/update_repository_storage_service.rb | 21 |
2 files changed, 52 insertions, 0 deletions
diff --git a/app/services/snippets/schedule_bulk_repository_shard_moves_service.rb b/app/services/snippets/schedule_bulk_repository_shard_moves_service.rb new file mode 100644 index 00000000000..f7bdd0a99a5 --- /dev/null +++ b/app/services/snippets/schedule_bulk_repository_shard_moves_service.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Snippets + # Tries to schedule a move for every snippet with repositories on the source shard + class ScheduleBulkRepositoryShardMovesService + include ScheduleBulkRepositoryShardMovesMethods + extend ::Gitlab::Utils::Override + + private + + override :repository_klass + def repository_klass + SnippetRepository + end + + override :container_klass + def container_klass + Snippet + end + + override :container_column + def container_column + :snippet_id + end + + override :schedule_bulk_worker_klass + def self.schedule_bulk_worker_klass + ::SnippetScheduleBulkRepositoryShardMovesWorker + end + end +end diff --git a/app/services/snippets/update_repository_storage_service.rb b/app/services/snippets/update_repository_storage_service.rb new file mode 100644 index 00000000000..3addae3b3be --- /dev/null +++ b/app/services/snippets/update_repository_storage_service.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Snippets + class UpdateRepositoryStorageService + include UpdateRepositoryStorageMethods + + delegate :snippet, to: :repository_storage_move + + private + + def track_repository(destination_storage_name) + snippet.track_snippet_repository(destination_storage_name) + end + + def mirror_repositories + return unless snippet.repository_exists? + + mirror_repository(type: Gitlab::GlRepository::SNIPPET) + end + end +end |