PhoenixKit.Modules.Storage.StorageProfile (phoenix_kit v2.41.0)

Copy Markdown View Source

A storage profile: where a library's bytes live (V205).

A library points at a profile (storage_profile_uuid; NULL means the Default, PhoenixKit.Modules.Storage.Profiles.default_uuid/0). The profile lists its buckets (PhoenixKit.Modules.Storage.ProfileBucket: role, what each stores, write priority, serve order, status) and says how many copies an object gets:

  • copies_originals — copies of an original upload (1..5);
  • copies_variants — copies of a derived file: a size, a tile, a render (1..5; a variant can be regenerated, so 1 is usually enough);
  • min_copies_on_write — an upload fails unless at least this many copies were written (1..copies_originals); the rest are made by the reconciler.

revision goes up on every change to the profile or its buckets. A file records the profile and revision it was placed by, and is stale, for the reconciler, when either differs from its library's.

Go through PhoenixKit.Modules.Storage.Profiles rather than this schema.

Summary

Functions

Name and copy counts. is_default and revision are never cast.

Types

t()

@type t() :: %PhoenixKit.Modules.Storage.StorageProfile{
  __meta__: term(),
  buckets:
    [PhoenixKit.Modules.Storage.ProfileBucket.t()]
    | Ecto.Association.NotLoaded.t(),
  copies_originals: pos_integer(),
  copies_variants: pos_integer(),
  inserted_at: DateTime.t() | nil,
  is_default: boolean(),
  min_copies_on_write: pos_integer(),
  name: String.t() | nil,
  revision: pos_integer(),
  updated_at: DateTime.t() | nil,
  uuid: UUIDv7.t() | nil
}

Functions

changeset(profile, attrs)

Name and copy counts. is_default and revision are never cast.