Ecto schema for a derived variant of a media asset.
A MediaVariant represents one named output (e.g. :thumb, :large)
derived from a source asset. Each variant moves through the
variant lifecycle and stores its own storage key,
recipe digest, and ready/failed/stale state.
States
| State | Meaning |
|---|---|
"planned" | Variant row exists; processing not yet enqueued. |
"queued" | Oban job enqueued; awaiting processor. |
"processing" | Processor is generating the variant. |
"ready" | Variant generated and stored; deliverable. |
"failed" | Processing failed past the retry budget. |
"stale" | Recipe digest changed; existing object outdated. |
"missing" | Storage reconciliation found the object absent. |
"purged" | Variant explicitly removed; storage object deleted. |
See the state table below for valid transitions and stale-serving behavior.
Summary
Functions
Builds a changeset for a variant row.
Types
@type t() :: %Rindle.Domain.MediaVariant{ __meta__: term(), asset: term(), asset_id: term(), byte_size: term(), content_type: term(), duration_ms: term(), error_reason: term(), generated_at: term(), height: term(), id: term(), inserted_at: term(), name: term(), output_kind: term(), recipe_digest: term(), state: term(), storage_key: term(), updated_at: term(), width: term() }
Functions
@spec changeset( t() | %Rindle.Domain.MediaVariant{ __meta__: term(), asset: term(), asset_id: term(), byte_size: term(), content_type: term(), duration_ms: term(), error_reason: term(), generated_at: term(), height: term(), id: term(), inserted_at: term(), name: term(), output_kind: term(), recipe_digest: term(), state: term(), storage_key: term(), updated_at: term(), width: term() }, map() ) :: Ecto.Changeset.t()
Builds a changeset for a variant row.
Casts the variant-recipe, storage, and lifecycle columns; requires the
minimum invariants (:asset_id, :name, :state, :recipe_digest);
validates the lifecycle state against the canonical state list and enforces
uniqueness across (:asset_id, :name) so each variant exists at most once
per asset.