Skip to main content

DerivedFactSource

Trait DerivedFactSource 

Source
pub trait DerivedFactSource: Send + Sync {
    // Required methods
    fn lookup_derived(
        &self,
        rule_name: &str,
    ) -> Result<Vec<HashMap<String, Value>>, LocyError>;
    fn execute_pattern<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        pattern: &'life1 Pattern,
        where_conditions: &'life2 [Expr],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<RecordBatch>, LocyError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn lookup_derived_batches(
        &self,
        _rule_name: &str,
    ) -> Result<Vec<RecordBatch>, LocyError> { ... }
}
Expand description

Read-only access to derived facts and graph data.

Replaces CypherExecutor for read operations in the native command dispatch path. lookup_derived converts RecordBatch-based native facts to FactRow format internally.

Required Methods§

Source

fn lookup_derived( &self, rule_name: &str, ) -> Result<Vec<HashMap<String, Value>>, LocyError>

Look up all facts for a rule. Returns FactRow-based results.

Source

fn execute_pattern<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, pattern: &'life1 Pattern, where_conditions: &'life2 [Expr], ) -> Pin<Box<dyn Future<Output = Result<Vec<RecordBatch>, LocyError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Execute a graph MATCH query with optional WHERE conditions.

Returns raw RecordBatches so the native path stays columnar. Callers that need Vec<FactRow> must convert via record_batches_to_locy_rows.

Used by SLG clause resolution, EXPLAIN re-execution, and delta resolution. AST construction happens inside the adapter via build_match_return_query.

Provided Methods§

Source

fn lookup_derived_batches( &self, _rule_name: &str, ) -> Result<Vec<RecordBatch>, LocyError>

Look up all facts for a rule as raw RecordBatches (zero-copy from native store).

Default implementation returns an error. Override in native adapters to read directly from DerivedStore without converting to rows.

Implementors§