class
ActiveStorage::Blob::PurgeableTest::PrefixRecordingService
- ActiveStorage::Blob::PurgeableTest::PrefixRecordingService
- ActiveStorage::Service::DiskService
- ActiveStorage::Service
- Reference
- Object
Overview
Records the prefixes the service was asked to clear.
#delete_prefixed removes by prefix, so the prefix a purge passes is what decides whether it
takes the right objects or somebody else's.
:nodoc:
Defined in:
active_storage/blob/purgeable_test.crInstance Method Summary
-
#delete_prefixed(prefix : String) : Nil
Removes every object whose key starts with the passed prefix.
- #prefixes : Array(String)
Instance methods inherited from class ActiveStorage::Service::DiskService
delete(key : String) : Nil
delete,
delete_prefixed(prefix : String) : Nil
delete_prefixed,
download(key : String, & : Bytes -> ) : Nildownload(key : String) : String download, download_chunk(key : String, range : Range(Int64, Int64)) : String download_chunk, exist?(key : String) : Bool exist?, name : String name, path_for(key : String) : String path_for, private_url(key : String, expires_in : Time::Span, filename : ActiveStorage::Filename, disposition : String, content_type : String) private_url, public_url(key : String, filename : ActiveStorage::Filename, content_type : String, disposition : String) public_url, root : String root, upload(key : String, io : IO, checksum : String | Nil = nil, filename : ActiveStorage::Filename | Nil = nil, content_type : String | Nil = nil, disposition : String | Nil = nil) : Nil upload
Constructor methods inherited from class ActiveStorage::Service::DiskService
new(root : String, public : Bool = false)
new
Instance methods inherited from class ActiveStorage::Service
content_disposition_with(filename : Filename, type : String | Nil = "inline") : String
content_disposition_with,
delete(key : String) : Nil
delete,
delete_prefixed(prefix : String) : Nil
delete_prefixed,
download(key : String) : Stringdownload(key : String, & : Bytes -> ) : Nil download, download_chunk(key : String, range : Range(Int64, Int64)) : String download_chunk, exist?(key : String) : Bool exist?, private_url(key : String, expires_in : Time::Span, filename : Filename, disposition : String, content_type : String) private_url, public? : Bool public?, public_url(key : String, filename : Filename, content_type : String, disposition : String) public_url, upload(key : String, io : IO, checksum : String | Nil = nil, filename : Filename | Nil = nil, content_type : String | Nil = nil, disposition : String | Nil = nil) : Nil upload, url(key : String, expires_in : Time::Span, filename : Filename, content_type : String, disposition : String) url
Constructor methods inherited from class ActiveStorage::Service
new
new
Instance Method Detail
Removes every object whose key starts with the passed prefix.
The prefix goes through #path_for like any key, so it is sharded the same way and cannot
resolve outside of the root. Sharding reads the first characters of the whole key, so
variants/<blob key>/ lands under va/ri and not under the shard directories of the blob it
belongs to.
The glob reads what is under the prefix, so the emptied variants/<key>/ directory is left
behind, as #delete leaves the sharding directories. The matches take FileUtils.rm_rf because
a prefix can hold directories of its own.
https://github.com/rails/rails/blob/v8.1.3/activestorage/lib/active_storage/service/disk_service.rb