pub struct QueryProcessor { /* private fields */ }Expand description
Processes queries through the full pipeline.
The processor holds references to the stores and provides a unified interface for executing queries in any supported language.
§Example
use graphos_engine::query::processor::{QueryProcessor, QueryLanguage};
let processor = QueryProcessor::for_lpg(store);
let result = processor.process("MATCH (n:Person) RETURN n", QueryLanguage::Gql, None)?;Implementations§
Source§impl QueryProcessor
impl QueryProcessor
Sourcepub fn for_lpg_with_tx(
store: Arc<LpgStore>,
tx_manager: Arc<TransactionManager>,
) -> Self
pub fn for_lpg_with_tx( store: Arc<LpgStore>, tx_manager: Arc<TransactionManager>, ) -> Self
Creates a new query processor with a transaction manager.
Sourcepub fn with_tx_context(self, viewing_epoch: EpochId, tx_id: TxId) -> Self
pub fn with_tx_context(self, viewing_epoch: EpochId, tx_id: TxId) -> Self
Sets the transaction context for MVCC visibility.
This should be called when the processor is used within a transaction.
Sourcepub fn with_catalog(self, catalog: Arc<Catalog>) -> Self
pub fn with_catalog(self, catalog: Arc<Catalog>) -> Self
Sets a custom catalog.
Sourcepub fn with_optimizer(self, optimizer: Optimizer) -> Self
pub fn with_optimizer(self, optimizer: Optimizer) -> Self
Sets a custom optimizer.
Sourcepub fn process(
&self,
query: &str,
language: QueryLanguage,
params: Option<&QueryParams>,
) -> Result<QueryResult>
pub fn process( &self, query: &str, language: QueryLanguage, params: Option<&QueryParams>, ) -> Result<QueryResult>
Processes a query string and returns results.
Pipeline:
- Parse (language-specific parser → AST)
- Translate (AST → LogicalPlan)
- Bind (semantic validation)
- Optimize (filter pushdown, join reorder, etc.)
- Plan (logical → physical operators)
- Execute (run operators, collect results)
§Arguments
query- The query stringlanguage- Which query language to useparams- Optional query parameters for prepared statements
§Errors
Returns an error if any stage of the pipeline fails.
Source§impl QueryProcessor
impl QueryProcessor
Sourcepub fn new() -> Self
👎Deprecated since 0.1.0: Use QueryProcessor::for_lpg() instead
pub fn new() -> Self
Creates a new query processor (legacy API).
This creates a processor with an empty in-memory store.
Prefer using QueryProcessor::for_lpg with an explicit store.
Sourcepub fn process_legacy(&self, query: &str) -> Result<QueryResult>
👎Deprecated since 0.1.0: Use process() with explicit language
pub fn process_legacy(&self, query: &str) -> Result<QueryResult>
Processes a query using default GQL language (legacy API).
§Errors
Returns an error if the query fails.
Sourcepub fn tx_manager(&self) -> &Arc<TransactionManager>
pub fn tx_manager(&self) -> &Arc<TransactionManager>
Returns a reference to the transaction manager.