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§
Sourcetype Rule: Eq + Send + Sync
type Rule: Eq + Send + Sync
Identity/handle of a preflight-checked rule, unique across linked shapes.
Required Methods§
Sourcefn snapshot(
&mut self,
) -> impl Future<Output = Result<Self::Snapshot, Self::Error>> + Send
fn snapshot( &mut self, ) -> impl Future<Output = Result<Self::Snapshot, Self::Error>> + Send
Freeze selected base plus the current attempt’s inference graph.
Sourcefn begin_layer(
&mut self,
rules: &[Rule<Self::Rule>],
work: &mut Work,
) -> impl Future<Output = Result<(), Self::Error>> + Send
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.
Sourcefn execute(
&mut self,
rule: &Self::Rule,
snapshot: &Self::Snapshot,
phase: u64,
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
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.
Sourcefn merge_phase(
&mut self,
work: &mut Work,
) -> impl Future<Output = Result<u64, Self::Error>> + Send
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.
Sourcefn finish_layer(
&mut self,
rules: &[Rule<Self::Rule>],
work: &mut Work,
) -> impl Future<Output = Result<(), Self::Error>> + Send
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.
Sourcefn finish(
&mut self,
work: &mut Work,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn finish( &mut self, work: &mut Work, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Remove temporary triples and their annotations, without publishing output.
Sourcefn is_cancelled(&self) -> bool
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".