Class: Ci::DeletedObject

Inherits:
ApplicationRecord show all
Defined in:
app/models/ci/deleted_object.rb

Constant Summary

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

model_name, table_name_prefix

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

Class Method Details

.bulk_import(artifacts, pick_up_at = nil) ⇒ Object



18
19
20
21
22
23
24
25
# File 'app/models/ci/deleted_object.rb', line 18

def self.bulk_import(artifacts, pick_up_at = nil)
  attributes = artifacts.each.with_object([]) do |artifact, accumulator|
    record = artifact.to_deleted_object_attrs(pick_up_at)
    accumulator << record if record[:store_dir] && record[:file]
  end

  insert_all(attributes) if attributes.any?
end

Instance Method Details

#delete_file_from_storageObject



27
28
29
30
31
32
33
# File 'app/models/ci/deleted_object.rb', line 27

def delete_file_from_storage
  file.remove!
  true
rescue StandardError => e
  Gitlab::ErrorTracking.track_exception(e)
  false
end