Skip to main content

Module resource

Module resource 

Source
Expand description

Dependency-inverted resource-accessor bridge (SRD-104, Phase 0).

A polydat kernel 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 — it must not depend on the host runtime — so the bridge is expressed here as a type-erased trait plus a process-global install point:

  • The host (nbrs-runtime’s resource pool) implements ResourceAccessor and installs it into RESOURCE_ACCESSOR once at session start. The global is only a bridge to the pool; the pool remains the single, definitive owner of the resource.
  • A polydat node reaches a resource by calling resource_lookup, which consults the installed accessor. The payload is erased to Arc<dyn Any + Send + Sync> so polydat needs no host types; the consuming node downcasts it to its own concrete handle.

eval is synchronous and context-free, so a node cannot be handed a service reference or await a connect. This process-global registry is the established nb-rs pattern for a node reaching a live resource (the same shape dataset handles use). The lookup is a pure synchronous read of what the host has already attached; vivification timing is the host’s concern.

Statics§

RESOURCE_ACCESSOR
Process-global bridge to the host’s resource accessor, installed once by the runtime at session start. None (uninstalled) is the norm for any polydat use that has no host — the trait is a bridge, not a requirement.

Traits§

ResourceAccessor
Type-erased accessor over the host’s live resource store.

Functions§

resource_lookup
Look up an already-attached resource’s accessor payload by fingerprint key through the installed RESOURCE_ACCESSOR.