pub struct NodeRouter { /* private fields */ }Expand description
Node Router
Routes workflow node execution requests to the appropriate extension service. Uses the registry service to discover which services provide each node.
Implementations§
Source§impl NodeRouter
impl NodeRouter
Sourcepub fn new(registry: Arc<RegistryService>) -> Self
pub fn new(registry: Arc<RegistryService>) -> Self
Create a new node router with a registry service
Sourcepub fn with_timeout(self, timeout_ms: u64) -> Self
pub fn with_timeout(self, timeout_ms: u64) -> Self
Set default timeout for node execution
Sourcepub fn with_callback_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn with_callback_endpoint(self, endpoint: impl Into<String>) -> Self
Set default callback endpoint
Sourcepub async fn register_node(
&self,
_service_id: ServiceId,
node_def: NodeDefinition,
)
pub async fn register_node( &self, _service_id: ServiceId, node_def: NodeDefinition, )
Register a node from a service
Sourcepub async fn unregister_service_nodes(&self, service_id: &ServiceId)
pub async fn unregister_service_nodes(&self, service_id: &ServiceId)
Unregister all nodes from a service
Sourcepub async fn rebuild_index(&self) -> Result<(), NodeRouterError>
pub async fn rebuild_index(&self) -> Result<(), NodeRouterError>
Rebuild the node index from the registry
Sourcepub async fn route(
&self,
node_id: &str,
context: NodeContext,
request_id: JsonRpcId,
required_capabilities: Vec<NodeCapability>,
) -> Result<NodeRouteResult, NodeRouterError>
pub async fn route( &self, node_id: &str, context: NodeContext, request_id: JsonRpcId, required_capabilities: Vec<NodeCapability>, ) -> Result<NodeRouteResult, NodeRouterError>
Route a node execution request
Sourcepub async fn list_nodes(&self) -> Vec<NodeDefinition>
pub async fn list_nodes(&self) -> Vec<NodeDefinition>
List all available nodes
Sourcepub async fn get_node(&self, node_id: &str) -> Option<NodeDefinition>
pub async fn get_node(&self, node_id: &str) -> Option<NodeDefinition>
Get node definition
Sourcepub async fn get_nodes_by_type(
&self,
node_type: NodeType,
) -> Vec<NodeDefinition>
pub async fn get_nodes_by_type( &self, node_type: NodeType, ) -> Vec<NodeDefinition>
Get nodes by type
Sourcepub async fn get_nodes_by_capability(
&self,
capability: NodeCapability,
) -> Vec<NodeDefinition>
pub async fn get_nodes_by_capability( &self, capability: NodeCapability, ) -> Vec<NodeDefinition>
Get nodes by capability
Sourcepub fn create_node_request(
&self,
route_result: NodeRouteResult,
) -> JsonRpcRequest
pub fn create_node_request( &self, route_result: NodeRouteResult, ) -> JsonRpcRequest
Create a JSON-RPC request for node execution
Sourcepub fn create_error_response(
&self,
error: NodeRouterError,
request_id: JsonRpcId,
) -> JsonRpcResponse
pub fn create_error_response( &self, error: NodeRouterError, request_id: JsonRpcId, ) -> JsonRpcResponse
Create an error response for routing failures
Sourcepub async fn node_count(&self) -> usize
pub async fn node_count(&self) -> usize
Get the count of registered nodes
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for NodeRouter
impl !UnwindSafe for NodeRouter
impl Freeze for NodeRouter
impl Send for NodeRouter
impl Sync for NodeRouter
impl Unpin for NodeRouter
impl UnsafeUnpin for NodeRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more