Skip to main content

NodeRegistry

Trait NodeRegistry 

Source
pub trait NodeRegistry: Send + Sync {
    // Required methods
    fn node_meta(&self, node_id: &str) -> Option<NodeMeta>;
    fn config_hash(&self, node_id: &str) -> Option<CacheKey>;

    // Provided method
    fn meta(&self, node_id: &str) -> Option<FilterMeta> { ... }
}
Expand description

Registry that maps node IDs to their metadata.

The compiler needs metadata (cacheable, differentiable, schemas) but not the implementations behind it. One required accessor, answering for both kinds of node: an optional step_meta alongside a required meta is how half the schema validation came to be skipped by whichever registry forgot to override it.

Required Methods§

Source

fn node_meta(&self, node_id: &str) -> Option<NodeMeta>

A node’s contract — schemas, cacheability, effectfulness — whichever kind it is. None means the graph names a node nobody registered, which the compiler reports rather than guesses around.

Source

fn config_hash(&self, node_id: &str) -> Option<CacheKey>

The node’s configuration identity, folded into cache keys. Required rather than derived because only the registry knows how a node’s configuration is canonicalized (Rust: canonical CBOR of fields; Python: qualname + config + source hash).

Provided Methods§

Source

fn meta(&self, node_id: &str) -> Option<FilterMeta>

The computational view, for the phases that only make sense for a filter: gradient flow, differentiable collapsing.

None for an effectful node — deliberately. Those phases ask “should a gradient pass through here”, and the answer for a step is not “no, and warn about it” but “the question does not apply”.

Implementors§