Pure projection transitions for conserved Meter balances.
ExGAM.Kernel.Meter owns the account algebra. This module binds that
algebra to governed records: Act reservations, Mandate ownership,
corrections, and subtractive devolution. It mutates only disposable folded
state and performs no ledger append or external I/O.
Summary
Functions
Fetches one physical Meter account.
Fetches the physical accounts backing a logical Mandate revision.
Returns all free balances of a terminal child Mandate to its parent.
Creates physical accounts for a root Mandate allocation.
Fetches the physical owner for a logical Mandate revision.
Replaces physical accounts after a validated algebra transition.
Recontains a released reservation after a contradictory Outcome.
Fetches the current status and immutable binding for an Act reservation.
Returns the projected status for an Act reservation, or nil when absent.
Applies the first reservation for an Act.
Applies settle, release or suspend to an existing Act reservation.
Applies one account operation to every amount as a single pure transition.
Functions
@spec account(ExGAM.Kernel.Meter.accounts(), String.t()) :: {:ok, ExGAM.Kernel.Meter.Account.t()} | {:error, term()}
Fetches one physical Meter account.
@spec accounts(ExGAM.GovernedAct.State.t(), String.t()) :: {:ok, ExGAM.Kernel.Meter.accounts()} | {:error, term()}
Fetches the physical accounts backing a logical Mandate revision.
@spec devolve(ExGAM.GovernedAct.State.t(), map()) :: {:ok, ExGAM.GovernedAct.State.t()} | {:error, term()}
Returns all free balances of a terminal child Mandate to its parent.
@spec initialize( %{optional(String.t()) => ExGAM.Kernel.Meter.accounts()}, ExGAM.Mandate.t() ) :: %{ optional(String.t()) => ExGAM.Kernel.Meter.accounts() }
Creates physical accounts for a root Mandate allocation.
@spec owner(ExGAM.GovernedAct.State.t(), String.t()) :: {:ok, String.t()} | {:error, term()}
Fetches the physical owner for a logical Mandate revision.
@spec put_accounts( ExGAM.GovernedAct.State.t(), String.t(), ExGAM.Kernel.Meter.accounts() ) :: {:ok, ExGAM.GovernedAct.State.t()} | {:error, term()}
Replaces physical accounts after a validated algebra transition.
@spec recontain(ExGAM.GovernedAct.State.t(), map()) :: {:ok, ExGAM.GovernedAct.State.t()} | {:error, term()}
Recontains a released reservation after a contradictory Outcome.
@spec reservation(ExGAM.GovernedAct.State.t(), String.t()) :: {:ok, ExGAM.GovernedAct.State.meter_reservation()} | {:error, term()}
Fetches the current status and immutable binding for an Act reservation.
@spec reservation_status(ExGAM.GovernedAct.State.t(), String.t()) :: ExGAM.GovernedAct.State.reservation_status() | nil
Returns the projected status for an Act reservation, or nil when absent.
@spec reserve(ExGAM.GovernedAct.State.t(), map()) :: {:ok, ExGAM.GovernedAct.State.t()} | {:error, term()}
Applies the first reservation for an Act.
@spec transition(ExGAM.GovernedAct.State.t(), map(), :settle | :release | :suspend) :: {:ok, ExGAM.GovernedAct.State.t()} | {:error, term()}
Applies settle, release or suspend to an existing Act reservation.
@spec transition_accounts( ExGAM.Kernel.Meter.accounts(), ExGAM.Kernel.Meter.Amounts.t(), atom(), atom() ) :: {:ok, ExGAM.Kernel.Meter.accounts()} | {:error, term()}
Applies one account operation to every amount as a single pure transition.