AshIntrospection.ResourceInfo.Source (AshIntrospection v0.4.0)

Copy Markdown View Source

A %Ash.Info.Manifest{} with its lookup maps already built.

Ash.Info.Manifest.resource_lookup/1 and type_lookup/1 rebuild a map from a list on every call. AshIntrospection.ResourceInfo reads them dozens of times per request, so the maps are built once here and carried on the config map instead.

Callers pass either a bare %Ash.Info.Manifest{} or a prepared source under the :manifest config key; AshIntrospection.ResourceInfo.prepare/1 turns the first into the second. Preparing once and reusing the result is the supported shape — a bare manifest works and is O(resources) per read.

Summary

Types

t()

A manifest plus the module-keyed lookups read from it.

Functions

Builds the lookup maps for manifest.

Types

t()

@type t() :: %AshIntrospection.ResourceInfo.Source{
  manifest: Ash.Info.Manifest.t(),
  resources: %{required(module()) => Ash.Info.Manifest.Resource.t()},
  types: %{required(module()) => Ash.Info.Manifest.Type.t()}
}

A manifest plus the module-keyed lookups read from it.

Functions

new(source)

@spec new(Ash.Info.Manifest.t() | t()) :: t()

Builds the lookup maps for manifest.

Returns the source unchanged when it has already been prepared.