View Source AntikytheraEal.AssetStorage.Behaviour behaviour (antikythera v0.5.1)
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.
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.
Callbacks
@callback delete(key :: String.t()) :: :ok
Deletes an asset file identified by the given key
.
@callback list(Antikythera.GearName.t()) :: [String.t()]
Lists all already-stored asset files for the specified gear.
@callback 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.
@callback upload( path :: Path.t(), key :: String.t(), mime :: String.t(), gzip? :: boolean() ) :: :ok
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.