Module: ObjectStorage

Defined in:
app/uploaders/object_storage.rb,
lib/object_storage/config.rb,
lib/object_storage/direct_upload.rb,
app/workers/object_storage/background_move_worker.rb,
app/workers/object_storage/migrate_uploads_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Defined Under Namespace

Modules: BackgroundMove, Concern, Extension, Store Classes: BackgroundMoveWorker, Config, DirectUpload, ExclusiveLeaseTaken, MigrateUploadsWorker

Constant Summary collapse

RemoteStoreError =
Class.new(StandardError)
UnknownStoreError =
Class.new(StandardError)
ObjectStorageUnavailable =
Class.new(StandardError)
TMP_UPLOAD_PATH =
'tmp/uploads'
SUPPORTED_STORES =
[Store::LOCAL, Store::REMOTE].freeze

Instance Method Summary collapse

Instance Method Details

#unsafe_use_fileObject


496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'app/uploaders/object_storage.rb', line 496

def unsafe_use_file
  if file_storage?
    return yield path
  end

  begin
    cache_stored_file!
    yield cache_path
  ensure
    FileUtils.rm_f(cache_path)
    cache_storage.delete_dir!(cache_path(nil))
  end
end