GenServer-backed manifest that tracks staged file attachments, deduplicates by checksum,
and prunes expired entries on a schedule. This powers the public Codex.Files helpers.
Summary
Functions
Returns a specification to start this module under a supervisor.
Ensures the registry is running under application supervision.
Triggers an immediate cleanup pass to remove expired attachments.
Lists all staged attachments currently tracked in the manifest.
Aggregates counts, sizes, and TTL information for staged attachments.
Clears the manifest and deletes staged files within the provided staging directory.
Inserts or refreshes a staged attachment using the supplied options, returning the
canonical Attachment struct stored in ETS.
Types
@type stage_opts() :: %{ checksum: String.t(), name: String.t(), persist: boolean(), ttl_ms: :infinity | pos_integer(), size: non_neg_integer(), source_path: Path.t(), destination_path: Path.t() }
@type stage_request() :: {GenServer.from(), stage_opts(), DateTime.t()}
@type work_item() :: {:stage, String.t(), stage_opts()} | {:force_cleanup, GenServer.from(), DateTime.t()} | {:cleanup_tick, DateTime.t()} | {:reset, GenServer.from(), Path.t()} | :cleanup_orphaned_staging
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Ensures the registry is running under application supervision.
@spec force_cleanup() :: :ok | {:error, term()}
Triggers an immediate cleanup pass to remove expired attachments.
@spec list() :: [Codex.Files.Attachment.t()]
Lists all staged attachments currently tracked in the manifest.
@spec metrics() :: map()
Aggregates counts, sizes, and TTL information for staged attachments.
Clears the manifest and deletes staged files within the provided staging directory.
@spec stage(stage_opts()) :: {:ok, Codex.Files.Attachment.t()} | {:error, term()}
Inserts or refreshes a staged attachment using the supplied options, returning the
canonical Attachment struct stored in ETS.
@spec start_link(keyword()) :: GenServer.on_start()