Class: BulkImports::Export

Inherits:
ApplicationRecord show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/models/bulk_imports/export.rb

Constant Summary collapse

STARTED =
0
FINISHED =
1
FAILED =
-1

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Instance Method Summary collapse

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Instance Method Details

#configObject



59
60
61
62
63
# File 'app/models/bulk_imports/export.rb', line 59

def config
  strong_memoize(:config) do
    FileTransfer.config_for(portable)
  end
end

#portableObject



49
50
51
52
53
# File 'app/models/bulk_imports/export.rb', line 49

def portable
  strong_memoize(:portable) do
    project || group
  end
end

#portable_relation?Boolean

Returns:

  • (Boolean)


43
44
45
46
47
# File 'app/models/bulk_imports/export.rb', line 43

def portable_relation?
  return unless portable

  errors.add(:relation, 'Unsupported portable relation') unless config.portable_relations.include?(relation)
end

#relation_definitionObject



55
56
57
# File 'app/models/bulk_imports/export.rb', line 55

def relation_definition
  config.relation_definition_for(relation)
end

#remove_existing_upload!Object



65
66
67
68
69
70
# File 'app/models/bulk_imports/export.rb', line 65

def remove_existing_upload!
  return unless upload&.export_file&.file

  upload.remove_export_file!
  upload.save!
end