Class: Gitlab::Uploads::MigrationHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/uploads/migration_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, logger) ⇒ MigrationHelper

Returns a new instance of MigrationHelper.



8
9
10
# File 'lib/gitlab/uploads/migration_helper.rb', line 8

def initialize(args, logger)
  prepare_variables(args, logger)
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/gitlab/uploads/migration_helper.rb', line 6

def logger
  @logger
end

Instance Method Details

#migrate_to_local_storageObject



18
19
20
21
22
# File 'lib/gitlab/uploads/migration_helper.rb', line 18

def migrate_to_local_storage
  @to_store = ObjectStorage::Store::LOCAL

  uploads(ObjectStorage::Store::REMOTE).each_batch(of: batch_size, &method(:enqueue_batch))
end

#migrate_to_remote_storageObject



12
13
14
15
16
# File 'lib/gitlab/uploads/migration_helper.rb', line 12

def migrate_to_remote_storage
  @to_store = ObjectStorage::Store::REMOTE

  uploads.each_batch(of: batch_size, &method(:enqueue_batch))
end