instance method
mirror
Ruby on Rails 6.1.7.10
Since v6.1.7.10Signature
mirror(key, checksum:)
Copy the file at the key from the primary service to each of the mirrors where it doesn’t already exist.
Parameters
-
keyreq -
checksumkeyreq
Source
# File activestorage/lib/active_storage/service/mirror_service.rb, line 54
def mirror(key, checksum:)
instrument :mirror, key: key, checksum: checksum do
if (mirrors_in_need_of_mirroring = mirrors.select { |service| !service.exist?(key) }).any?
primary.open(key, checksum: checksum) do |io|
mirrors_in_need_of_mirroring.each do |service|
io.rewind
service.upload key, io, checksum: checksum
end
end
end
end
end
Defined in activestorage/lib/active_storage/service/mirror_service.rb line 54
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Service::MirrorService