ElixirScope.ASTRepository.Repository (elixir_scope v0.0.1)
Central repository for AST storage with runtime correlation capabilities.
Designed for high-performance access patterns:
- O(1) module lookup by name
- O(log n) correlation ID to AST node mapping
- O(1) instrumentation point retrieval
- O(log n) temporal range queries
Integrates with existing ElixirScope infrastructure:
- Uses ElixirScope.Storage.DataAccess patterns for ETS storage
- Follows ElixirScope.Config for configuration management
- Implements GenServer pattern like PipelineManager
Summary
Functions
Returns a specification to start this module under a supervisor.
Correlates a runtime event with AST nodes using correlation ID. Returns the AST node ID that correlates with the event.
Retrieves function data by function key.
Gets instrumentation points for a specific AST node.
Retrieves a module's data by name.
Gets repository statistics and performance metrics.
Performs a health check on the repository.
Creates a new repository instance (for testing or multiple repositories).
Starts the AST Repository with optional configuration.
Stores function-level data with runtime correlation capabilities.
Stores a module's AST data with instrumentation metadata.
Updates a module's data using an update function.
Types
@type ast_node_id() :: binary()
@type correlation_id() :: binary()
@type function_key() :: {module_name(), atom(), non_neg_integer()}
@type module_name() :: atom()
@type repository_id() :: binary()
@type t() :: %ElixirScope.ASTRepository.Repository{ ast_nodes_table: term(), configuration: term(), correlation_index: term(), creation_timestamp: term(), data_access: term(), functions_table: term(), instrumentation_points: term(), last_updated: term(), modules_table: term(), patterns_table: term(), performance_metrics: term(), repository_id: term(), runtime_correlator: term(), stats_table: term(), temporal_correlation: term(), version: term() }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec correlate_event(GenServer.server(), map()) :: {:ok, ast_node_id()} | {:error, term()}
Correlates a runtime event with AST nodes using correlation ID. Returns the AST node ID that correlates with the event.
@spec get_function(GenServer.server(), function_key()) :: {:ok, ElixirScope.ASTRepository.FunctionData.t()} | {:error, :not_found}
Retrieves function data by function key.
@spec get_instrumentation_points(GenServer.server(), ast_node_id()) :: {:ok, [map()]} | {:error, :not_found}
Gets instrumentation points for a specific AST node.
@spec get_module(GenServer.server(), module_name()) :: {:ok, ElixirScope.ASTRepository.ModuleData.t()} | {:error, :not_found}
Retrieves a module's data by name.
@spec get_statistics(GenServer.server()) :: {:ok, map()}
Gets repository statistics and performance metrics.
@spec health_check(GenServer.server()) :: {:ok, map()} | {:error, term()}
Performs a health check on the repository.
Creates a new repository instance (for testing or multiple repositories).
@spec start_link(keyword()) :: GenServer.on_start()
Starts the AST Repository with optional configuration.
Options
:name
- Process name (default: MODULE):config
- Repository configuration (merged with defaults):data_access
- Existing DataAccess instance (optional)
@spec store_function(GenServer.server(), ElixirScope.ASTRepository.FunctionData.t()) :: :ok | {:error, term()}
Stores function-level data with runtime correlation capabilities.
@spec store_module(GenServer.server(), ElixirScope.ASTRepository.ModuleData.t()) :: :ok | {:error, term()}
Stores a module's AST data with instrumentation metadata.
@spec update_module( GenServer.server(), module_name(), (ElixirScope.ASTRepository.ModuleData.t() -> ElixirScope.ASTRepository.ModuleData.t()) ) :: :ok | {:error, term()}
Updates a module's data using an update function.