ExGAM.GovernedAct.AuthorityChange (ExGAM v0.1.0)

Copy Markdown View Source

Pure interpretation of an authority-changing Act.

Both commit construction and replay need to answer the same two questions: which Mandate changed, and whether a pending descendant is affected. Keeping those answers here prevents dispatch cancellation from acquiring a second, subtly different ancestry implementation.

Summary

Functions

Checks whether a Mandate falls under the resolved authority change.

Returns the cascade policy declared by a Mandate, defaulting safely to false.

Resolves the target and cascade semantics of an already-folded authority change.

Types

resolution()

@type resolution() :: {:ok, String.t(), boolean()} | {:error, term()}

Functions

affects?(state, mandate_ref, target_ref, cascade?)

@spec affects?(map(), String.t(), String.t(), boolean()) ::
  {:ok, boolean()} | {:error, term()}

Checks whether a Mandate falls under the resolved authority change.

cascades?(state, mandate_ref)

@spec cascades?(map(), String.t()) :: boolean()

Returns the cascade policy declared by a Mandate, defaulting safely to false.

resolve(state, cause_act, reason)

@spec resolve(map(), ExGAM.Act.t(), :mandate_revoked | :mandate_restricted) ::
  resolution()

Resolves the target and cascade semantics of an already-folded authority change.