Search documentation of macula

# macula_mri_registry (macula v4.4.9)

View Source

MRI Type Registry

Manages the registry of valid MRI types with their schemas. Provides both built-in types and runtime registration of custom types.

Built-in types are always valid. Custom types can be registered at runtime and optionally scoped to specific realms.

# Summary

## Functions

get_type_schema(Type)

Get the schema for a type.

handle_call(Request, From, State)
handle_cast(Msg, State)
handle_info(Info, State)
init(Opts)
is_valid_type(Type)

Check if a type is valid (built-in or registered).

is_valid_type(Type, Realm)

Check if a type is valid for a specific realm.

list_custom_types()

List only custom registered types.

list_types()

List all valid types (built-in + custom).

path_schema(Type)

Get the path schema for a type.

register_type(TypeBin, Schema)

Register a custom type with schema. Schema map can contain: - description: binary() - Human-readable description - path_schema: [atom()] - Path segment roles (e.g., [org, device_id]) - parent_type: atom() - Type of the parent MRI - realm: binary() - Restrict to this realm (undefined = global)

start_link()

Start the registry as a linked process.

start_link(Opts)

Start the registry with options.

terminate(Reason, State)
unregister_type(TypeBin)

Unregister a custom type.

validate_path_for_type(Type, Path)

Validate that a path matches the expected schema for a type.

# Functions

# get_type_schema(Type)

    -spec get_type_schema(atom() | binary()) -> {ok, map()} | {error, not_found}.

Get the schema for a type.

# handle_call(Request, From, State)

# handle_cast(Msg, State)

# handle_info(Info, State)

# init(Opts)

# is_valid_type(Type)

    -spec is_valid_type(atom() | binary()) -> boolean().

Check if a type is valid (built-in or registered).

# is_valid_type(Type, Realm)

    -spec is_valid_type(atom() | binary(), binary()) -> boolean().

Check if a type is valid for a specific realm.

# list_custom_types()

    -spec list_custom_types() -> [binary()].

List only custom registered types.

# list_types()

    -spec list_types() -> [atom() | binary()].

List all valid types (built-in + custom).

# path_schema(Type)

    -spec path_schema(atom() | binary()) -> {ok, [atom()]} | {error, not_found}.

Get the path schema for a type.

# register_type(TypeBin, Schema)

    -spec register_type(binary(), map()) -> ok | {error, term()}.

Register a custom type with schema. Schema map can contain: - description: binary() - Human-readable description - path_schema: [atom()] - Path segment roles (e.g., [org, device_id]) - parent_type: atom() - Type of the parent MRI - realm: binary() - Restrict to this realm (undefined = global)

# start_link()

    -spec start_link() -> {ok, pid()} | {error, term()}.

Start the registry as a linked process.

# start_link(Opts)

    -spec start_link(list()) -> {ok, pid()} | {error, term()}.

Start the registry with options.

# terminate(Reason, State)

# unregister_type(TypeBin)

    -spec unregister_type(binary()) -> ok | {error, term()}.

Unregister a custom type.

# validate_path_for_type(Type, Path)

    -spec validate_path_for_type(atom() | binary(), [binary()]) -> ok | {error, term()}.

Validate that a path matches the expected schema for a type.