Macaw.Frame.Catalog.Store (macaw_frame v0.1.0)

Copy Markdown View Source

The catalog store (spec/13 §1.3): a registry's catalog modules as a read-only Macaw.Layers.Store of frame document fragments, its context the registry (%{id => module}, Macaw.Frame.Catalog.registry/1). Reach it through Macaw.Frame.Catalog.store/1.

An entry's id is the fragment's catalog id ("charts.line"), so a use site refs it as it would any stored fragment; its name is the id too. list/1 answers each id with its doc, parameters and slots beside the store's summary keys. put/2, delete/2 and import/2 are refused with :read_only: a host layers its own store over this one to hold a variant under its own id.

iex> {:ok, store} = Macaw.Frame.Catalog.store([])
iex> Macaw.Layers.Store.put(store, %{id: nil, name: "mine", fragment: %{}})
{:error, :read_only}

Summary

Functions

Refused: the catalog is read-only.

The entry of an id: {:ok, %{id, name, fragment}}, or {:error, :not_found}.

Refused: the catalog is read-only.

Every entry's summary, by id: %{id, name, kind, doc, parameters, slots}, its kind the fragment's (:design), its parameters in order.

Refused: the catalog is read-only.

The fragment type the store holds: the frame document.

Functions

delete(id, registry)

@spec delete(term(), term()) :: {:error, :read_only}

Refused: the catalog is read-only.

get(id, registry)

@spec get(term(), term()) :: {:ok, map()} | {:error, :not_found | term()}

The entry of an id: {:ok, %{id, name, fragment}}, or {:error, :not_found}.

import(bundle, registry)

@spec import(term(), term()) :: {:error, [Macaw.Base.Fault.t(), ...]}

Refused: the catalog is read-only.

list(registry)

@spec list(term()) :: {:ok, [map()]} | {:error, term()}

Every entry's summary, by id: %{id, name, kind, doc, parameters, slots}, its kind the fragment's (:design), its parameters in order.

put(entry, registry)

@spec put(term(), term()) :: {:error, :read_only}

Refused: the catalog is read-only.

types(registry)

@spec types(term()) :: [module()]

The fragment type the store holds: the frame document.