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

Copy Markdown View Source

One bucket of a storage profile (V205), and how the profile uses it.

  • role — primary (written and served), replica (written; served when no primary has the object) or backup (written; read only by repair and the reconciler, never served).
  • stores — all, originals (original uploads only) or derived (sizes, tiles and renders only).
  • write_priority — writes go to buckets with a fixed priority first (lowest first), then to the rest in random order (nil).
  • serve_order — among the buckets that hold an object and may serve it, the lowest is served from.
  • status — active, read_only (keeps serving, gets no new writes) or draining (the reconciler copies its objects to the profile's other buckets, then unlinks them).
  • storage_class and encryption are reserved for later (G10); storage_class is allowed only on a backup row, because archive tiers need a restore before a read.

A bucket's global enabled flag is still the emergency stop: a disabled bucket is neither written nor read, whatever its profile rows say.

Summary

Functions

How a profile uses a bucket. The keys are set by the caller.

The roles, in the order buckets are written and served.

The statuses.

What a bucket may store.

Types

t()

@type t() :: %PhoenixKit.Modules.Storage.ProfileBucket{
  __meta__: term(),
  bucket:
    PhoenixKit.Modules.Storage.Bucket.t() | Ecto.Association.NotLoaded.t(),
  bucket_uuid: UUIDv7.t() | nil,
  encryption: map() | nil,
  inserted_at: DateTime.t() | nil,
  profile: term(),
  profile_uuid: UUIDv7.t() | nil,
  role: String.t(),
  serve_order: integer(),
  status: String.t(),
  storage_class: String.t() | nil,
  stores: String.t(),
  updated_at: DateTime.t() | nil,
  write_priority: integer() | nil
}

Functions

changeset(row, attrs)

How a profile uses a bucket. The keys are set by the caller.

roles()

The roles, in the order buckets are written and served.

statuses()

The statuses.

stores()

What a bucket may store.