PhoenixKit.Storage.FileLocation (phoenix_kit v1.6.15)
View SourceSchema for physical storage locations (redundancy tracking).
Tracks where each file instance is physically stored. Each instance can have multiple locations for redundancy (1-5 copies across different buckets).
Redundancy Example
If storage_redundancy_copies = 2, each file instance will have 2 location records:
# Location 1: Backblaze B2
%FileLocation{
path: "/uploads/018e3c4a-9f6b-7890-thumbnail.jpg",
status: "active",
priority: 0,
file_instance_id: "...",
bucket_id: "b2_bucket_id"
}
# Location 2: Cloudflare R2
%FileLocation{
path: "/uploads/018e3c4a-9f6b-7890-thumbnail.jpg",
status: "active",
priority: 0,
file_instance_id: "...",
bucket_id: "r2_bucket_id"
}Status Flow
active- File is available at this locationsyncing- File is being uploaded/copiedfailed- Upload or sync faileddeleted- File has been removed from this location
Fields
path- Full path within the bucketstatus- Current state of this locationpriority- Retrieval priority (0 = lowest, higher = preferred)last_verified_at- Last health check timestampfile_instance_id- Which instance this location storesbucket_id- Which bucket this file is stored in
Examples
# Active location on local storage
%FileLocation{
path: "/var/uploads/018e3c4a-9f6b-7890-large.jpg",
status: "active",
priority: 0,
last_verified_at: ~N[2025-10-28 10:00:00],
file_instance_id: "...",
bucket_id: "local_bucket_id"
}
# Syncing to cloud backup
%FileLocation{
path: "/uploads/018e3c4a-9f6b-7890-large.jpg",
status: "syncing",
priority: 0,
file_instance_id: "...",
bucket_id: "s3_bucket_id"
}
Summary
Functions
Returns whether this location is active and available.
Changeset for creating or updating a file location.
Returns whether this location has been deleted.
Returns whether this location has failed.
Returns whether this location is currently syncing.
Types
@type t() :: %PhoenixKit.Storage.FileLocation{ __meta__: term(), bucket: PhoenixKit.Storage.Bucket.t() | Ecto.Association.NotLoaded.t(), bucket_id: UUIDv7.t() | nil, file_instance: PhoenixKit.Storage.FileInstance.t() | Ecto.Association.NotLoaded.t(), file_instance_id: UUIDv7.t() | nil, id: UUIDv7.t() | nil, inserted_at: NaiveDateTime.t() | nil, last_verified_at: NaiveDateTime.t() | nil, path: String.t(), priority: integer(), status: String.t(), updated_at: NaiveDateTime.t() | nil }
Functions
Returns whether this location is active and available.
Changeset for creating or updating a file location.
Required Fields
pathfile_instance_idbucket_id
Validation Rules
- Status must be valid (active, syncing, failed, deleted)
- Priority must be >= 0
Returns whether this location has been deleted.
Returns whether this location has failed.
Returns whether this location is currently syncing.