Codex.Files.Registry (Codex SDK v0.3.0)
View SourceGenServer-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, starting it under the current process when necessary.
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() }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Ensures the registry is running, starting it under the current process when necessary.
@spec force_cleanup() :: :ok
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.
@spec reset(Path.t()) :: :ok
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.