Module: UpdateRepositoryStorageMethods

Includes:
Gitlab::Utils::StrongMemoize
Included in:
Projects::UpdateRepositoryStorageService, Snippets::UpdateRepositoryStorageService
Defined in:
app/services/concerns/update_repository_storage_methods.rb

Constant Summary collapse

Error =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#repository_storage_moveObject (readonly)

Returns the value of attribute repository_storage_move.



8
9
10
# File 'app/services/concerns/update_repository_storage_methods.rb', line 8

def repository_storage_move
  @repository_storage_move
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/services/concerns/update_repository_storage_methods.rb', line 16

def execute
  response = repository_storage_move.with_lock do
    next ServiceResponse.success unless repository_storage_move.scheduled?

    repository_storage_move.start!

    nil
  end

  return response if response

  unless same_filesystem?
    mirror_repositories

    repository_storage_move.transaction do
      mirror_object_pool(destination_storage_name)
    end
  end

  repository_storage_move.transaction do
    repository_storage_move.finish_replication!

    track_repository(destination_storage_name)
  end

  remove_old_paths unless same_filesystem?

  repository_storage_move.finish_cleanup!

  ServiceResponse.success
rescue StandardError => e
  repository_storage_move.do_fail!

  Gitlab::ErrorTracking.track_and_raise_exception(e, container_klass: container.class.to_s, container_path: container.full_path)
end

#initialize(repository_storage_move) ⇒ Object



12
13
14
# File 'app/services/concerns/update_repository_storage_methods.rb', line 12

def initialize(repository_storage_move)
  @repository_storage_move = repository_storage_move
end