Where a stored object is: its phoenix_kit_file_locations rows (V204).
An object is named by its key (FileInstance.file_name). Several
instances may share one key (a cross-user copy, a tile written twice), and
each instance has one location row per bucket that holds the object
(phoenix_kit_file_locations_instance_bucket_index).
PhoenixKit.Modules.Storage.Manager reads, serves and checks objects
through this: the buckets the rows name come first, then the other
enabled buckets, and when one of those turns out to hold the object, a row
is recorded for it (record/2). That fallback is what keeps files stored
before every writer recorded its locations working while
Storage.Workers.LocationBackfillJob has not reached them yet.
Summary
Functions
The uuids of the buckets the active location rows of key name.
Whether key is known to be in no bucket: every instance stored under it
was checked and found nowhere, and nothing has recorded it since. A read
then answers "not found" without asking every bucket again.
Orders buckets so the ones in located come first, each group keeping
its own order. The first group is where the rows say the object is; the
second is the fallback.
Marks instances checked against every bucket, found in found_in of
them. Never raises.
How many instances have not been checked against every bucket yet.
Records that bucket_uuid holds the object at key: an active location
row for every instance stored under that key that has none on that
bucket. Returns how many rows were added. Never raises.
Records every bucket in bucket_uuids for key (record/2 each) and
marks the key's instances checked: what a writer calls once its instance
row exists, with the buckets the manager stored the object in (a writer
knows every bucket it wrote).
The instances not checked against every bucket yet: what
LocationBackfillJob walks. Not "has no location row": a read that finds
a key records one bucket, and a missing object never gets a row.
Functions
The uuids of the buckets the active location rows of key name.
Whether key is known to be in no bucket: every instance stored under it
was checked and found nowhere, and nothing has recorded it since. A read
then answers "not found" without asking every bucket again.
Orders buckets so the ones in located come first, each group keeping
its own order. The first group is where the rows say the object is; the
second is the fallback.
@spec mark_checked([term()], non_neg_integer()) :: :ok
Marks instances checked against every bucket, found in found_in of
them. Never raises.
@spec missing_count() :: non_neg_integer()
How many instances have not been checked against every bucket yet.
@spec record(String.t(), term()) :: non_neg_integer()
Records that bucket_uuid holds the object at key: an active location
row for every instance stored under that key that has none on that
bucket. Returns how many rows were added. Never raises.
@spec record_all(String.t(), [term()]) :: non_neg_integer()
Records every bucket in bucket_uuids for key (record/2 each) and
marks the key's instances checked: what a writer calls once its instance
row exists, with the buckets the manager stored the object in (a writer
knows every bucket it wrote).
@spec unchecked_query() :: Ecto.Query.t()
The instances not checked against every bucket yet: what
LocationBackfillJob walks. Not "has no location row": a read that finds
a key records one bucket, and a missing object never gets a row.