Spectre.GAM.Label (Spectre v0.4.0)

Copy Markdown View Source

Canonical information constraint with an explicit owner.

Spectre.GAM does not interpret value or impose a label taxonomy. The stable reference binds that portable value to the principal which may authorize its removal.

Summary

Functions

Returns the plain, string-keyed representation.

Returns the reference derived from owner and value.

Returns the stable digest of the complete label.

Restores a label and verifies its content reference.

Builds a canonical, content-addressed label.

Normalizes, de-duplicates and orders labels by stable reference.

Types

t()

@type t() :: %Spectre.GAM.Label{
  owner_ref: String.t(),
  ref: String.t(),
  schema_version: 1,
  value: term()
}

Functions

canonical(label)

@spec canonical(t()) :: map()

Returns the plain, string-keyed representation.

content_ref(label)

@spec content_ref(t()) :: String.t()

Returns the reference derived from owner and value.

digest(label)

@spec digest(t()) :: String.t()

Returns the stable digest of the complete label.

from_canonical(value)

@spec from_canonical(map()) :: {:ok, t()} | {:error, term()}

Restores a label and verifies its content reference.

new(label)

@spec new(t() | map() | keyword()) :: {:ok, t()} | {:error, term()}

Builds a canonical, content-addressed label.

normalize_many(labels)

@spec normalize_many(term()) :: {:ok, [t()]} | {:error, term()}

Normalizes, de-duplicates and orders labels by stable reference.