Anvil.Export.Manifest (Anvil v0.1.1)
View SourceExport manifest for tracking dataset lineage and reproducibility.
Manifests include:
- Export metadata (queue, schema version, format)
- File hash for integrity verification
- Export parameters for reproducibility
- Anvil version for compatibility tracking
Summary
Functions
Computes the SHA256 hash of a file.
Parses a JSON string into a manifest struct.
Loads a manifest from a file.
Creates a new manifest with the given parameters.
Saves the manifest to a file.
Converts the manifest to a JSON string.
Types
@type t() :: %Anvil.Export.Manifest{ anvil_version: String.t(), export_id: String.t(), exported_at: DateTime.t(), format: :csv | :jsonl | :parquet | :huggingface, output_path: String.t(), parameters: map(), queue_id: binary(), row_count: non_neg_integer(), sample_version: String.t() | nil, schema_definition_hash: String.t() | nil, schema_version_id: binary(), sha256_hash: String.t() }
Functions
Computes the SHA256 hash of a file.
Uses streaming to handle large files without loading them into memory.
Examples
iex> Anvil.Export.Manifest.compute_file_hash("/tmp/export.csv")
{:ok, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}
Parses a JSON string into a manifest struct.
Examples
iex> json = ~s({"export_id": "exp_123", ...})
iex> Anvil.Export.Manifest.from_json(json)
{:ok, %Anvil.Export.Manifest{...}}
Loads a manifest from a file.
Examples
iex> Anvil.Export.Manifest.load("/tmp/export.csv.manifest.json")
{:ok, %Anvil.Export.Manifest{...}}
Creates a new manifest with the given parameters.
Examples
iex> Anvil.Export.Manifest.new(%{
...> queue_id: "queue_123",
...> schema_version_id: "schema_v1",
...> format: :csv,
...> output_path: "/tmp/export.csv",
...> row_count: 100,
...> sha256_hash: "abc123",
...> exported_at: ~U[2025-12-01 10:00:00Z],
...> parameters: %{}
...> })
%Anvil.Export.Manifest{...}
Saves the manifest to a file.
By default, saves to <output_path>.manifest.json.
A custom path can be provided as the second argument.
Examples
iex> manifest = %Anvil.Export.Manifest{output_path: "/tmp/export.csv", ...}
iex> Anvil.Export.Manifest.save(manifest)
:ok
# Creates /tmp/export.csv.manifest.json
iex> Anvil.Export.Manifest.save(manifest, "/tmp/custom.json")
:ok
# Creates /tmp/custom.json
Converts the manifest to a JSON string.
Examples
iex> manifest = %Anvil.Export.Manifest{...}
iex> Anvil.Export.Manifest.to_json(manifest)
"{\"export_id\": \"exp_123\", ...}"