Expand description
Dependency-inverted resource-accessor bridge.
A polydat node sometimes needs a live, host-owned resource (the
first consumer is a CQL Session) addressed by its configuration
fingerprint. polydat is the dependency floor and does not depend
on the host runtime, so the bridge is a type-erased trait,
ResourceAccessor, which the host implements over its own store.
The accessor belongs to a program tree, not to the process. A
ResourceScope is the tree’s slot for it: a host installs an
accessor when it compiles (CompileOptions::resources) or later, on
the kernel it holds (crate::Kernel::resources). Every program of
the tree shares the one scope: for bodies, subscopes built under a
kernel of the tree, and every kernel created from or forked off one
of its programs. A node reaches the scope through the
BuildContext its factory
receives, keeps it, and looks a resource up when it evaluates. Two
trees in one process each see their own accessor.
A program compiled on its own has a scope of its own. Binding one of
its kernels under a parent (crate::kernel::bind_under) joins that
scope to the parent’s (ResourceScope::join): while the child’s
scope has no accessor installed, its lookups resolve through the
parent’s. The link is on the scope, so every kernel of the child’s
program shares it, and an accessor installed once at the root serves
every image bound beneath it.
A lookup is a synchronous read of what the host has already
attached: it never blocks and never connects, and the payload is
erased to Arc<dyn Any + Send + Sync>, which the consuming node
downcasts to its own concrete handle type.
Structs§
- Resource
Scope - A program tree’s slot for its host’s
ResourceAccessor.
Enums§
- Scope
Join Error - Why
ResourceScope::joinleft a scope joined to nothing.
Traits§
- Resource
Accessor - Type-erased accessor over the host’s live resource store.