Object.SchemaRegistry (object v0.1.2)

ETS-based registry for tracking object schemas and evolution. Provides fast lookup and atomic updates for the object schema space.

Summary

Functions

Returns a specification to start this module under a supervisor.

Finds objects compatible with the specified object.

Gets all object schemas as a map.

Gets the schema for a specific object.

Gets the schema evolution history for an object.

Lists all registered objects and their schemas.

Lists objects filtered by subtype.

Registers an object's schema in the registry.

Starts the schema registry GenServer.

Unregisters an object from the schema registry.

Updates an object's schema and records the evolution.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

find_compatible_objects(object_id, compatibility_threshold \\ 0.7)

Finds objects compatible with the specified object.

Parameters

  • object_id - ID of the reference object
  • compatibility_threshold - Minimum compatibility score (default: 0.7)

Returns

  • {:ok, compatible_objects} - List of compatible objects with scores
  • {:error, reason} - Object not found or other error

get_all_schemas()

Gets all object schemas as a map.

Returns

Map of object IDs to schemas

get_object_schema(object_id)

Gets the schema for a specific object.

Parameters

  • object_id - ID of the object

Returns

  • {:ok, schema} - Object schema found
  • {:error, :not_found} - Object not found

get_schema_evolution_history(object_id)

Gets the schema evolution history for an object.

Parameters

  • object_id - ID of the object

Returns

  • {:ok, history} - Evolution history list

list_objects()

Lists all registered objects and their schemas.

Returns

List of tuples with object IDs and schemas

list_objects_by_type(object_type)

Lists objects filtered by subtype.

Parameters

  • object_type - Object subtype to filter by

Returns

List of objects matching the specified type

register_object(object)

Registers an object's schema in the registry.

Parameters

  • object - Object struct to register

Returns

  • :ok - Object schema registered successfully

start_link(_)

Starts the schema registry GenServer.

Creates ETS tables for fast schema lookup and evolution tracking.

Returns

  • {:ok, pid} - Successfully started schema registry

unregister_object(object_id)

Unregisters an object from the schema registry.

Parameters

  • object_id - ID of the object to unregister

Returns

  • :ok - Object unregistered successfully

update_object_schema(object_id, schema_updates)

Updates an object's schema and records the evolution.

Parameters

  • object_id - ID of the object to update
  • schema_updates - Schema changes to apply

Returns

  • :ok - Schema updated successfully
  • {:error, :object_not_found} - Object not found