ElixirScope.ASTRepository.RuntimeCorrelator (elixir_scope v0.0.1)
Runtime correlation bridge that maps runtime events to AST nodes.
This module provides the core functionality for correlating runtime execution events with static AST analysis data, enabling the hybrid architecture.
Key responsibilities:
- Map correlation IDs from runtime events to AST node IDs
- Maintain temporal correlation data
- Provide fast lookup capabilities (<5ms target)
- Update AST repository with runtime insights
Summary
Functions
Returns a specification to start this module under a supervisor.
Correlates a runtime event with AST nodes.
Batch correlates multiple runtime events for better performance.
Gets all runtime events correlated with a specific AST node.
Gets all runtime events correlated with a specific AST node, ordered chronologically.
Gets correlation statistics and performance metrics.
Performs a health check on the correlator.
Queries events within a time range for temporal correlation.
Starts the RuntimeCorrelator with the given repository and configuration.
Updates the correlation mapping for an AST node.
Types
@type ast_node_id() :: binary()
@type correlation_id() :: binary()
@type correlation_result() :: {:ok, ast_node_id()} | {:error, term()}
@type runtime_event() :: map()
@type t() :: %ElixirScope.ASTRepository.RuntimeCorrelator{ cache_size_limit: term(), cleanup_interval: term(), correlation_cache: term(), correlation_timeout: term(), data_access: term(), failed_correlations: term(), performance_tracking: term(), repository_pid: term(), start_time: term(), statistics: term(), successful_correlations: term(), temporal_index: term(), total_correlations: term() }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec correlate_event(GenServer.server(), runtime_event()) :: correlation_result()
Correlates a runtime event with AST nodes.
Returns the AST node ID that correlates with the event, or an error if no correlation can be established.
@spec correlate_events(GenServer.server(), [runtime_event()]) :: {:ok, [{correlation_id(), ast_node_id()}]} | {:error, term()}
Batch correlates multiple runtime events for better performance.
@spec get_events_for_ast_node(GenServer.server(), ast_node_id()) :: {:ok, [runtime_event()]} | {:error, term()}
Gets all runtime events correlated with a specific AST node, ordered chronologically.
This is the primary function for AST-centric debugging queries.
@spec get_statistics(GenServer.server()) :: {:ok, map()}
Gets correlation statistics and performance metrics.
@spec health_check(GenServer.server()) :: {:ok, map()} | {:error, term()}
Performs a health check on the correlator.
@spec query_temporal_events(GenServer.server(), integer(), integer()) :: {:ok, [runtime_event()]} | {:error, term()}
Queries events within a time range for temporal correlation.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the RuntimeCorrelator with the given repository and configuration.
@spec update_correlation_mapping(GenServer.server(), correlation_id(), ast_node_id()) :: :ok
Updates the correlation mapping for an AST node.