Behaviour for variant stores.
A variant store persists Image.Plug.Variant records keyed by
name. Reads are expected to be cheap (every request that resolves a
variant performs one read); writes are expected to be infrequent.
The default implementation Image.Plug.VariantStore.ETS is
in-memory. A file-backed and a database-backed store may follow in
later milestones.
Summary
Callbacks
Deletes a variant by name.
Fetches a variant by name.
Lists every stored variant. The order is implementation-defined.
Inserts or updates a variant.
Callbacks
Deletes a variant by name.
Returns :ok or {:error, :not_found}.
@callback get(name :: String.t(), options :: keyword()) :: {:ok, Image.Plug.Variant.t()} | {:error, :not_found}
Fetches a variant by name.
Returns {:ok, variant} or {:error, :not_found}.
@callback list(options :: keyword()) :: {:ok, [Image.Plug.Variant.t()]}
Lists every stored variant. The order is implementation-defined.
@callback put(Image.Plug.Variant.t(), options :: keyword()) :: {:ok, Image.Plug.Variant.t()} | {:error, term()}
Inserts or updates a variant.
Returns {:ok, stored} where stored may differ from the input
(for example, with :inserted_at / :updated_at populated).