Stores and retrieves export files and other persistent artifacts.
Threadline uses Threadline.Storage.Local by default. Select another built-in
or custom adapter in your host application's configuration:
config :threadline, storage_adapter: MyApp.AuditStorageA custom adapter implements this behaviour. Threadline passes the keyword list
stored under the adapter module to init/1 during application startup when a
repository is configured:
config :threadline, MyApp.AuditStorage, region: "us-east-1"Return :ok from init/1 only when the adapter is ready. Returning
{:error, reason} or raising prevents Threadline's supervision tree from
starting, so missing dependencies and invalid configuration fail early.
put/2 accepts binary content as the portable cross-adapter contract and
returns an opaque file identifier used by the remaining callbacks. The built-in
Local adapter also accepts the path of an existing regular file as a
Local-specific convenience; custom and remote adapters do not need to support
that shortcut.
path/1 is optional. Implement it only when the web process can serve a
stored file from its local filesystem. When it is absent, or returns
{:error, :not_local}, export delivery uses download_url/2 instead.
See Threadline.Storage.Local for single-node storage and
Threadline.Storage.S3 for optional S3-compatible object storage.
Summary
Callbacks
Deletes a file from storage.
Generates a URL for downloading the file.
Retrieves a file's content from storage.
Initializes the adapter from its module-keyed configuration.
Returns a direct local path to the stored file when supported by the adapter.
Stores binary content.
Types
Callbacks
Deletes a file from storage.
Generates a URL for downloading the file.
Threadline may pass :expires_in in seconds. Remote adapters commonly return
a short-lived presigned URL; adapters that cannot generate a URL return an
adapter-specific error.
Retrieves a file's content from storage.
Initializes the adapter from its module-keyed configuration.
Threadline calls this during application startup. Return {:error, reason}
for invalid configuration or unavailable dependencies.
Returns a direct local path to the stored file when supported by the adapter.
This callback is optional. Adapters without a locally readable file should
omit it or return {:error, :not_local}.
Stores binary content.
Returns {:ok, file_id} where file_id is a backend-specific identifier
(such as an S3 key or a local filesystem path) that can be used with get/1
and download_url/2.