Class: Projects::HashedStorage::MigrationService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/projects/hashed_storage/migration_service.rb

Instance Attribute Summary collapse

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

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

#initialize(project, old_disk_path, logger: nil) ⇒ MigrationService

Returns a new instance of MigrationService.


8
9
10
11
12
# File 'app/services/projects/hashed_storage/migration_service.rb', line 8

def initialize(project, old_disk_path, logger: nil)
  @project = project
  @old_disk_path = old_disk_path
  @logger = logger || Gitlab::AppLogger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger


6
7
8
# File 'app/services/projects/hashed_storage/migration_service.rb', line 6

def logger
  @logger
end

#old_disk_pathObject (readonly)

Returns the value of attribute old_disk_path


6
7
8
# File 'app/services/projects/hashed_storage/migration_service.rb', line 6

def old_disk_path
  @old_disk_path
end

Instance Method Details

#executeObject


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/services/projects/hashed_storage/migration_service.rb', line 14

def execute
  # Migrate repository from Legacy to Hashed Storage
  unless project.hashed_storage?(:repository)
    return false unless migrate_repository_service.execute
  end

  # Migrate attachments from Legacy to Hashed Storage
  unless project.hashed_storage?(:attachments)
    return false unless migrate_attachments_service.execute
  end

  true
end