AshBackendDrivenOptimisticUi.Registry (AshBackendDrivenOptimisticUi v0.1.0)

Copy Markdown View Source

Every rule of the host app in one payload, with a version.

rules/0 reads the :ash_domains of the app named by config :ash_backend_driven_optimistic_ui, otp_app: :my_app and caches the result in :persistent_term; rules/1 builds from an explicit domain list, uncached. The payload is %{"version" => hash, "rules" => rules} where hash is the first 16 hex characters of the SHA-256 of the rules.

Each rule is AshBackendDrivenOptimisticUi.Rules' %{"effects" => [...]} plus "reactions": every on of any resource that answers an event the rule pushes, following pushes made by reactions in turn, in discovery order:

%{"on" => "xp_awarded", "type" => "wallet", "effects" => [effect]}

A reaction runs once per {event, type} per rule, so cycles end.

Summary

Functions

The :ash_domains of the host app named by the :otp_app setting.

Every resource of domains that declares rules or reactions.

The payload for the app's registered domains, built once per VM.

The payload for domains, uncached.

Just the hash of rules/0.

Functions

app_domains()

@spec app_domains() :: [module()]

The :ash_domains of the host app named by the :otp_app setting.

rule_resources(domains)

@spec rule_resources([module()]) :: [module()]

Every resource of domains that declares rules or reactions.

rules()

@spec rules() :: %{required(String.t()) => term()}

The payload for the app's registered domains, built once per VM.

rules(domains)

@spec rules([module()]) :: %{required(String.t()) => term()}

The payload for domains, uncached.

version()

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

Just the hash of rules/0.