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 HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::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, nullable_column?, 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 ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Class Method Details

.bulk_import(artifacts, pick_up_at = nil) ⇒ Object



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

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



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

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