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 grafeo_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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QueryProcessor
impl !RefUnwindSafe for QueryProcessor
impl Send for QueryProcessor
impl Sync for QueryProcessor
impl Unpin for QueryProcessor
impl !UnwindSafe for QueryProcessor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more