antikythera v0.4.0 AntikytheraEal.AssetStorage.Behaviour behaviour View Source
Interface to work with storage of asset files.
See AntikytheraEal
for common information about pluggable interfaces defined in antikythera.
All callbacks defined in this behaviour are called only within operational mix tasks; they are not used at runtime.
Asset files stored in the storage may be delivered via CDN.
It's the callback module's responsibility to properly set headers such as cache-control
for each asset file.
Link to this section Summary
Callbacks
Deletes an asset file identified by the given key
.
Lists all already-stored asset files for the specified gear.
Lists common key prefixes of all already-stored asset files for all gears.
Uploads the given asset file to the storage.
Link to this section Callbacks
Specs
delete(key :: String.t()) :: :ok
Deletes an asset file identified by the given key
.
Specs
list(Antikythera.GearName.t()) :: [String.t()]
Lists all already-stored asset files for the specified gear.
Specs
list_toplevel_prefixes() :: [String.t()]
Lists common key prefixes of all already-stored asset files for all gears.
Based on the key format defined in Antikythera.Asset
,
the prefixes are expected to be the list of gear names which have already-stored asset files.
Specs
Uploads the given asset file to the storage.
Parameters:
path
: File path of the asset file to upload.key
: Upload location (typically path part of URL) for the asset file (computed byAntikythera.Asset
).mime
: MIME type of the asset file.gzip?
: Whether gzip compression is beneficial for the asset file.