pub struct AtomResolver<'a> { /* private fields */ }Expand description
Resolves a Grounded edge target to the foreign atom
it names, by content-address agreement across the loaded connected archives.
Built once from a manifest + the supplied peer archives, gated so every declared ontology’s archive matches its pinned root. Each connected ontology is indexed by its nodes’ definition-bearing addresses, so resolution is an O(log n) lookup, never a scan.
Implementations§
Source§impl<'a> AtomResolver<'a>
impl<'a> AtomResolver<'a>
Sourcepub fn new(
manifest: &ConnectedOntologies,
peers: &'a BTreeMap<String, Archive>,
) -> Result<Self, LinkError>
pub fn new( manifest: &ConnectedOntologies, peers: &'a BTreeMap<String, Archive>, ) -> Result<Self, LinkError>
Build the resolver from the manifest and the loaded peers (by name).
Fail-closed: a declared ontology with no supplied archive is
MissingPeerArchive; a supplied archive
whose root disagrees with the pinned root is RootMismatch.
Only after every pin agrees is any atom index built.
Sourcepub fn resolve(&self, target: &EdgeTarget) -> Result<&'a Definition, LinkError>
pub fn resolve(&self, target: &EdgeTarget) -> Result<&'a Definition, LinkError>
Resolve a grounded edge target to its foreign atom. Fail-closed: an
undeclared ontology or an absent atom returns a typed LinkError, never
a silent miss. A Local target is
NotGrounded — there is nothing foreign to
resolve.