Tune.Artifact (Tune v0.5.0)

Copy Markdown View Source

A versioned learned-value artifact with safe provenance.

Summary

Functions

Decodes and validates a JSON artifact.

Encodes a validated artifact as canonical JSON.

Builds and validates an artifact from data.

Validates an artifact.

Types

t()

@type t() :: %Tune.Artifact{
  parameters: map(),
  provenance: map(),
  target_fingerprint: String.t(),
  version: pos_integer()
}

Functions

decode(json, opts \\ [])

@spec decode(String.t(), keyword()) :: {:ok, t()} | {:error, Exception.t()}

Decodes and validates a JSON artifact.

encode(artifact)

@spec encode(t()) :: {:ok, String.t()} | {:error, Exception.t()}

Encodes a validated artifact as canonical JSON.

new(attrs)

@spec new(map()) :: {:ok, t()} | {:error, Exception.t()}

Builds and validates an artifact from data.

validate(artifact)

@spec validate(t()) :: :ok | {:error, Exception.t()}

Validates an artifact.