Skip to main content

QueryProcessor

Struct QueryProcessor 

Source
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

Source

pub fn for_lpg(store: Arc<LpgStore>) -> Self

Creates a new query processor for LPG queries.

Source

pub fn for_lpg_with_tx( store: Arc<LpgStore>, tx_manager: Arc<TransactionManager>, ) -> Self

Creates a new query processor with a transaction manager.

Source

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.

Source

pub fn with_catalog(self, catalog: Arc<Catalog>) -> Self

Sets a custom catalog.

Source

pub fn with_optimizer(self, optimizer: Optimizer) -> Self

Sets a custom optimizer.

Source

pub fn process( &self, query: &str, language: QueryLanguage, params: Option<&QueryParams>, ) -> Result<QueryResult>

Processes a query string and returns results.

Pipeline:

  1. Parse (language-specific parser → AST)
  2. Translate (AST → LogicalPlan)
  3. Bind (semantic validation)
  4. Optimize (filter pushdown, join reorder, etc.)
  5. Plan (logical → physical operators)
  6. Execute (run operators, collect results)
§Arguments
  • query - The query string
  • language - Which query language to use
  • params - Optional query parameters for prepared statements
§Errors

Returns an error if any stage of the pipeline fails.

Source

pub fn lpg_store(&self) -> &Arc<LpgStore>

Returns a reference to the LPG store.

Source

pub fn catalog(&self) -> &Arc<Catalog>

Returns a reference to the catalog.

Source

pub fn optimizer(&self) -> &Optimizer

Returns a reference to the optimizer.

Source§

impl QueryProcessor

Source

pub fn new() -> Self

👎Deprecated since 0.1.0: Use QueryProcessor::for_lpg() instead

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.

Source

pub fn process_legacy(&self, query: &str) -> Result<QueryResult>

👎Deprecated since 0.1.0: Use process() with explicit language

Processes a query using default GQL language (legacy API).

§Errors

Returns an error if the query fails.

Source

pub fn tx_manager(&self) -> &Arc<TransactionManager>

Returns a reference to the transaction manager.

Trait Implementations§

Source§

impl Default for QueryProcessor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more