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

repository_destroy_service.rb « geo « services « app « ee - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 89e354544edd0124aa7dc8298f0ed4f93ef98775 (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
module Geo
  class RepositoryDestroyService
    attr_reader :id, :name, :disk_path, :repository_storage

    def initialize(id, name, disk_path, repository_storage)
      @id = id
      @name = name
      @disk_path = disk_path
      @repository_storage = repository_storage
    end

    def async_execute
      GeoRepositoryDestroyWorker.perform_async(id, name, disk_path, repository_storage)
    end

    def execute
      ::Projects::DestroyService.new(deleted_project, nil).geo_replicate
    end

    private

    def deleted_project
      # We don't have access to the original model anymore, so we are
      # rebuilding only what our service class requires
      ::Geo::DeletedProject.new(id: id,
                                name: name,
                                disk_path: disk_path,
                                repository_storage: repository_storage)
    end
  end
end