Class: Gitlab::Uploads::MigrationHelper

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

Constant Summary collapse

CATEGORIES =
[%w(AvatarUploader Project :avatar),
%w(AvatarUploader Group :avatar),
%w(AvatarUploader User :avatar),
%w(AttachmentUploader Note :attachment),
%w(AttachmentUploader Appearance :logo),
%w(AttachmentUploader Appearance :header_logo),
%w(FaviconUploader Appearance :favicon),
%w(FileUploader Project),
%w(PersonalFileUploader Snippet),
%w(NamespaceFileUploader Snippet),
%w(DesignManagement::DesignV432x230Uploader DesignManagement::Action :image_v432x230),
%w(FileUploader MergeRequest)].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, logger) ⇒ MigrationHelper

Returns a new instance of MigrationHelper.


21
22
23
# File 'lib/gitlab/uploads/migration_helper.rb', line 21

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

Class Method Details

.categoriesObject


25
26
27
# File 'lib/gitlab/uploads/migration_helper.rb', line 25

def self.categories
  CATEGORIES
end

Instance Method Details

#migrate_to_local_storageObject


35
36
37
38
39
# File 'lib/gitlab/uploads/migration_helper.rb', line 35

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


29
30
31
32
33
# File 'lib/gitlab/uploads/migration_helper.rb', line 29

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

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