haive.core.graph.node.registry

Node registry for managing and accessing nodes.

This module provides a registry for node configurations, allowing nodes to be registered, looked up, and managed throughout the application.

Classes

NodeRegistry

Registry for node configurations and types.

Module Contents

class haive.core.graph.node.registry.NodeRegistry[source]

Bases: haive.core.registry.base.AbstractRegistry[haive.core.graph.node.config.NodeConfig]

Registry for node configurations and types.

This registry keeps track of all registered node configurations and implements the AbstractRegistry interface from the Haive framework.

It provides methods for: - Registering node configurations - Looking up nodes by ID, name, or type - Listing all nodes or nodes of a specific type - Registering custom node types

Initialize the registry with empty storage.

clear()[source]

Clear all registrations.

Return type:

None

find_by_id(id)[source]

Find a node configuration by ID.

Parameters:

id (str) – Node ID

Returns:

Node configuration if found, None otherwise

Return type:

haive.core.graph.node.config.NodeConfig | None

find_by_name(name)[source]

Find a node configuration by name (searches all types).

Parameters:

name (str) – Node name

Returns:

Node configuration if found, None otherwise

Return type:

haive.core.graph.node.config.NodeConfig | None

get(item_type, name)[source]

Get a node configuration by type and name.

Parameters:
Returns:

Node configuration if found, None otherwise

Return type:

haive.core.graph.node.config.NodeConfig | None

get_all(item_type)[source]

Get all nodes of a specific type.

Parameters:

item_type (haive.core.graph.node.types.NodeType) – Node type

Returns:

Dictionary mapping node names to configurations

Return type:

dict[str, haive.core.graph.node.config.NodeConfig]

classmethod get_instance()[source]

Get the singleton instance of the registry.

Return type:

NodeRegistry

list(item_type)[source]

List all node names of a specific type.

Parameters:

item_type (haive.core.graph.node.types.NodeType) – Node type

Returns:

List of node names

Return type:

list[str]

list_all_names()[source]

List all registered node names across all types.

Returns:

List of all node names

Return type:

list[str]

register(item)[source]

Register a node configuration.

Parameters:

item (haive.core.graph.node.config.NodeConfig) – Node configuration to register

Returns:

The registered node configuration

Return type:

haive.core.graph.node.config.NodeConfig

register_custom_node_type(name, config_class)[source]

Register a custom node configuration class.

Parameters:
Return type:

None