Expand description
Multi-hop rule resolution with loop detection for the IPFRS distributed logic engine.
This module extends distributed backward chaining with multi-hop traversal across
peer nodes, tracking which (peer_id, goal_hash) pairs have been visited to
prevent infinite loops in circular rule configurations.
§Overview
The central entry point is MultiHopResolver::resolve, which:
- Attempts local KB resolution (facts + one rule level) first.
- On failure, discovers remote peers via the
find_providerscallback. - Delegates the goal to each peer via
remote_query, recording each hop in aHopTrace. - Returns a
MultiHopResultindicating whether the goal was resolved, the full hop trace, and any top-level variable bindings.
Loop detection is handled by VisitedSet: before each local or remote
attempt the (peer_id, goal_hash) pair is inserted; if it already exists
the attempt is skipped and false is returned immediately.
Structs§
- HopRecord
- Records one hop in a multi-hop derivation chain.
- HopTrace
- Complete trace of all hops taken during a multi-hop resolution attempt.
- Multi
HopConfig - Configuration governing multi-hop resolution behaviour.
- Multi
HopResolver - Multi-hop backward-chaining resolver with loop detection.
- Multi
HopResult - Result of a multi-hop resolution attempt.
- Visited
Set - Tracks which
(peer_id, goal_hash)pairs have been visited to prevent loops.