Artistry::Registry
Constants
A field an index can name: letters, digits, _ and -, starting with
a letter or _, with . between the names of nested fields
(meta.author).
Constructors
Class methods
Ask for an index on a kind's fields, in order, for plugin's common
lookups: Artifact.where fixing the leading fields (or all of them)
then reads one range of the index instead of every artifact of the
kind. Any plugin may ask, for any kind, given by code or name.
Indexes are shared: asking for fields already indexed records plugin
as wanting the index too, and it stays until every plugin that asked
has dropped it (drop_index). They cover current versions only, so
where(..., include_superseded: true) doesn't use them. Raises
InvalidIndex.
Ask for an index on a kind's fields, in order, for plugin's common
lookups: Artifact.where fixing the leading fields (or all of them)
then reads one range of the index instead of every artifact of the
kind. Any plugin may ask, for any kind, given by code or name.
Indexes are shared: asking for fields already indexed records plugin
as wanting the index too, and it stays until every plugin that asked
has dropped it (drop_index). They cover current versions only, so
where(..., include_superseded: true) doesn't use them. Raises
InvalidIndex.
Allocate a free one- or two-letter code for a kind name.
Tries the first letter, then the first letter followed by each later letter of the name, then the first letter followed by A-Z. Codes are capped at two letters because slugs ("C42", "42C") are parsed that way.
Withdraw plugin's claim on the index over fields, and drop the
index once no plugin claims it. Returns whether plugin had claimed it.
Withdraw plugin's claim on the index over fields, and drop the
index once no plugin claims it. Returns whether plugin had claimed it.
Lookup a registration by plugin and kind
Lookup a registration by kind name only (returns first match if multiple plugins use same kind)
Get the schema JSON for a code and version
A kind's indexes, each with the plugins that asked for it.
Register a new artifact kind. Returns the assigned code.
Schema is a JSON Schema as any JSON-serializable value. Raises
InvalidSchema if it can't be parsed, so it fails here rather than
on every create.
index lists the indexes this plugin asks for on the kind, as
add_index does: each entry a field or an ordered list of fields
(["title", ["voice", "bit"]]). Leaving one out later doesn't drop it;
drop_index does.
code declares the kind's code (one or two uppercase letters) so it
doesn't depend on registration order. Without it, a code is allocated
from the kind name. Raises InvalidCode, CodeConflict (another kind
owns the code) or CodeMismatch (this kind is already registered
under a different code).