Module: ObjectStorage

Defined in:
app/uploaders/object_storage.rb,
lib/object_storage/config.rb,
lib/object_storage/fog_helpers.rb,
app/uploaders/object_storage/s3.rb,
app/uploaders/object_storage/cdn.rb,
lib/object_storage/direct_upload.rb,
lib/object_storage/pending_direct_upload.rb,
app/uploaders/object_storage/cdn/google_cdn.rb,
app/uploaders/object_storage/cdn/google_ip_cache.rb,
app/workers/object_storage/migrate_uploads_worker.rb,
app/workers/object_storage/delete_stale_direct_uploads_worker.rb,
app/services/object_storage/delete_stale_direct_uploads_service.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Defined Under Namespace

Modules: CDN, Concern, Extension, FogHelpers, S3, Store Classes: Config, DeleteStaleDirectUploadsService, DeleteStaleDirectUploadsWorker, DirectUpload, DirectUploadStorage, ExclusiveLeaseTaken, MigrateUploadsWorker, PendingDirectUpload

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#direct_upload_final_pathObject



603
604
605
# File 'app/uploaders/object_storage.rb', line 603

def direct_upload_final_path
  model.try(direct_upload_final_path_attribute_name)
end

#direct_upload_final_path_attribute_nameObject



599
600
601
# File 'app/uploaders/object_storage.rb', line 599

def direct_upload_final_path_attribute_name
  "#{mounted_as}_final_path"
end

#unsafe_use_fileObject



585
586
587
588
589
590
591
592
593
594
595
596
597
# File 'app/uploaders/object_storage.rb', line 585

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