#primary (readonly)
[ GitHub ]# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 10
attr_reader :primary, :mirrors
123456789_123456789_123456789_123456789_123456789_
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
self,
::ActiveStorage::Service
|
|
| Inherits: |
ActiveStorage::Service
|
| Defined in: | activestorage/lib/active_storage/service/mirror_service.rb |
Wraps a set of mirror services and provides a single ::ActiveStorage::Service object that will all have the files uploaded to them. A #primary service is designated to answer calls to #download, exists?, and #url.
::ActiveStorage::Service - Inherited::ActiveStorage::Service - Inherited| .configure | Configure an Active Storage service by name from a set of configurations, typically loaded from a YAML file. |
::ActiveSupport::Autoload - Extended::ActiveStorage::Service - InheritedDelete the file at the key on all services.
Delete files at keys starting with the prefix on all services.
Upload the io to the key specified to all services.
::ActiveStorage::Service - Inherited| #delete | Delete the file at the |
| #delete_prefixed | Delete files at keys starting with the |
| #download | Return the content of the file at the |
| #download_chunk | Return the partial content in the byte |
| #exist? | Return |
| #headers_for_direct_upload | Returns a |
| #update_metadata | Update metadata for the file identified by |
| #upload | Upload the |
| #url | Returns a signed, temporary URL for the file at the |
| #url_for_direct_upload | Returns a signed, temporary URL that a direct upload file can be PUT to on the |
MirrorService
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 12
delegate :download, :download_chunk, :exist?, :url, :path_for, to: :primary
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 10
attr_reader :primary, :mirrors
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 12
delegate :download, :download_chunk, :exist?, :url, :path_for, to: :primary
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 10
attr_reader :primary, :mirrors
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 12
delegate :download, :download_chunk, :exist?, :url, :path_for, to: :primary
Delete the file at the key on all services.
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 34
def delete(key) perform_across_services :delete, key end
Delete files at keys starting with the prefix on all services.
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 39
def delete_prefixed(prefix) perform_across_services :delete_prefixed, prefix end
Boolean
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 12
delegate :download, :download_chunk, :exist?, :url, :path_for, to: :primary
Upload the io to the key specified to all services. If a checksum is provided, all services will ensure a match when the upload has completed or raise an ::ActiveStorage::IntegrityError.
# File 'activestorage/lib/active_storage/service/mirror_service.rb', line 27
def upload(key, io, checksum: nil, **) each_service.collect do |service| service.upload key, io.tap(&:rewind), checksum: checksum, ** end end