Spectre.GAM.Kernel.Meter.Account (Spectre v0.4.0)

Copy Markdown View Source

Disposable balance for one Meter allocation.

The surrounding governed state identifies the physical owner. The account keeps only the Meter identity and its conserved quantities, so restriction successors can share the same allocation without duplicating ownership metadata in every balance.

Meter units, precision and rate windows remain host-defined extensions until the governed model specifies their durable representation. The core uses non-negative integers and never guesses those semantics.

Summary

Functions

Creates an empty child balance before subtractive delegation.

Creates the initial balance issued by a root Mandate.

Validates identity, integer quantities and the conservation equation.

Types

t()

@type t() :: %Spectre.GAM.Kernel.Meter.Account{
  available: non_neg_integer(),
  ceiling: non_neg_integer(),
  delegated: non_neg_integer(),
  meter_ref: String.t(),
  reserved: non_neg_integer(),
  spent: non_neg_integer(),
  suspended: non_neg_integer()
}

Functions

child(meter_ref)

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

Creates an empty child balance before subtractive delegation.

root(meter_ref, ceiling)

@spec root(String.t(), non_neg_integer()) :: t()

Creates the initial balance issued by a root Mandate.

validate(account)

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

Validates identity, integer quantities and the conservation equation.