Squidie.GraphMutation (squidie v0.3.7)

Copy Markdown View Source

Normalized, version-fenced request to change one run's active graph.

Normalization establishes a deterministic transport contract. It does not decide whether identities, lifecycle transitions, or graph topology are valid for a particular run.

Summary

Functions

Returns versioned ordered content for duplicate comparison.

Returns a stable SHA-256 fingerprint of the canonical mutation content.

Normalizes atom- or string-keyed mutation input without consulting run state.

Converts a normalized mutation to its deterministic persistence map.

Types

normalize_error()

@type normalize_error() :: {:invalid_graph_mutation, {atom() | String.t(), term()}}

t()

@type t() :: %Squidie.GraphMutation{
  additions: [Squidie.GraphMutation.Operation.t()],
  expected_version: non_neg_integer(),
  mutation_id: String.t(),
  origin: String.t(),
  removals: [Squidie.GraphMutation.Operation.t()]
}

Functions

canonical_content(mutation)

@spec canonical_content(t()) :: tuple()

Returns versioned ordered content for duplicate comparison.

fingerprint(mutation)

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

Returns a stable SHA-256 fingerprint of the canonical mutation content.

normalize(attrs)

@spec normalize(term()) :: {:ok, t()} | {:error, normalize_error()}

Normalizes atom- or string-keyed mutation input without consulting run state.

to_map(mutation)

@spec to_map(t()) :: map()

Converts a normalized mutation to its deterministic persistence map.