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

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, write priority, serve order, status) and says how many copies an object gets, counted per kind of bucket:

  • copies_local — copies on local buckets (0..5);
  • copies_cloud — copies on cloud buckets (S3, B2, R2, Tigris) (0..5): two on the server's disks and one in the cloud, which survives the server;
  • min_copies_on_write — an upload fails unless at least this many copies were written (1..total); the rest are made by the reconciler.

The counts are for every file: an original and what is made from it get the same. copies_originals is the total (copies_local + copies_cloud, 1..5, held by a CHECK) and copies_variants is not used: changeset/2 keeps both equal to it, so the older columns never say something else.

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, the copy counts and the key layout. 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_cloud: non_neg_integer(),
  copies_local: non_neg_integer(),
  copies_originals: pos_integer(),
  copies_variants: pos_integer(),
  inserted_at: DateTime.t() | nil,
  is_default: boolean(),
  key_levels: 0..3,
  min_copies_on_write: pos_integer(),
  name: String.t() | nil,
  owner_uuid: UUIDv7.t() | nil,
  revision: pos_integer(),
  updated_at: DateTime.t() | nil,
  uuid: UUIDv7.t() | nil
}

Functions

changeset(profile, attrs)

Name, the copy counts and the key layout. is_default and revision are never cast.

copies_originals (the total) and copies_variants are not cast either: they follow copies_local + copies_cloud whenever that changes.