Skip to main content

RuleBackend

Trait RuleBackend 

Source
pub trait RuleBackend: Send {
    type Rule: Eq + Send + Sync;
    type Snapshot: Send + Sync;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn snapshot(
        &mut self,
    ) -> impl Future<Output = Result<Self::Snapshot, Self::Error>> + Send;
    fn begin_layer(
        &mut self,
        rules: &[Rule<Self::Rule>],
        work: &mut Work,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn execute(
        &mut self,
        rule: &Self::Rule,
        snapshot: &Self::Snapshot,
        phase: u64,
        work: &mut Work,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn merge_phase(
        &mut self,
        work: &mut Work,
    ) -> impl Future<Output = Result<u64, Self::Error>> + Send;
    fn finish_layer(
        &mut self,
        rules: &[Rule<Self::Rule>],
        work: &mut Work,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn finish(
        &mut self,
        work: &mut Work,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn is_cancelled(&self) -> bool;
}
Expand description

Native graph/query capabilities required by the scheduling controller.

This port extends beyond triple scans: a SPARQL evaluator may need an entire pinned dataset context. Never silently flatten named graphs or copy a graph into controller memory. Reuse canonical storage/query adapters. All callbacks must observe cancellation and charge streamed reads, focus nodes, expression work and candidate output through Work::charge. Dictionary, nesting, I/O, and query-engine internal budgets remain mandatory backend obligations.

Required Associated Types§

Source

type Rule: Eq + Send + Sync

Identity/handle of a preflight-checked rule, unique across linked shapes.

Source

type Snapshot: Send + Sync

Owned immutable view: later staging and merges cannot change its results.

Source

type Error: Error + Send + Sync + 'static

Typed native failure, never translated into absence or an empty result.

Required Methods§

Source

fn snapshot( &mut self, ) -> impl Future<Output = Result<Self::Snapshot, Self::Error>> + Send

Freeze selected base plus the current attempt’s inference graph.

Source

fn begin_layer( &mut self, rules: &[Rule<Self::Rule>], work: &mut Work, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Compute this layer’s expected derived triples once before either phase. rules identifies exactly the preflight-checked rules in this layer.

Source

fn execute( &mut self, rule: &Self::Rule, snapshot: &Self::Snapshot, phase: u64, work: &mut Work, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Execute one rule against exactly snapshot, staging into a separate phase.

Global rules receive no focus binding. Shape rules stream the deduplicated union of active targets across linked shapes and test all active conditions. Preserve actual rule/focus/source/shapes/snapshot/phase evidence and fresh term identity. Do not forge RDFS proofs. phase is an attempt-local ordinal. No staged candidate may become visible to another execution in this phase.

Source

fn merge_phase( &mut self, work: &mut Work, ) -> impl Future<Output = Result<u64, Self::Error>> + Send

Merge the complete pending phase; return only novel inferred triples. Deduplicate in indexed scratch, preserving assertion precedence and evidence.

Source

fn finish_layer( &mut self, rules: &[Rule<Self::Rule>], work: &mut Work, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Remove this layer’s derived-only triples and annotations; retain those independently inferred by rules. Called only after a proved fixed point.

Source

fn finish( &mut self, work: &mut Work, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Remove temporary triples and their annotations, without publishing output.

Source

fn is_cancelled(&self) -> bool

Whether the pinned attempt has been cancelled or superseded.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§