Class: Projects::HashedStorage::RollbackRepositoryService

Inherits:
BaseRepositoryService show all
Defined in:
app/services/projects/hashed_storage/rollback_repository_service.rb

Instance Attribute Summary

Attributes inherited from BaseRepositoryService

#logger, #move_design, #move_wiki, #new_disk_path, #old_disk_path, #old_storage_version

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseRepositoryService

#initialize

Methods included from Gitlab::ShellAdapter

#gitlab_shell

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from Projects::HashedStorage::BaseRepositoryService

Instance Method Details

#executeObject


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
# File 'app/services/projects/hashed_storage/rollback_repository_service.rb', line 6

def execute
  try_to_set_repository_read_only!

  @old_storage_version = project.storage_version
  project.storage_version = nil

  @new_disk_path = project.disk_path

  result = move_repositories

  if result
    project.write_repository_config
    project.track_project_repository
  else
    rollback_folder_move
    project.storage_version = ::Project::HASHED_STORAGE_FEATURES[:repository]
  end

  project.repository_read_only = false
  project.save!(validate: false)

  if result && block_given?
    yield
  end

  result
end