Expand description
torvyn-linker — Component linking and pipeline composition for Torvyn.
This crate implements the static, ahead-of-execution linking algorithm
described in HLI Document 02, Section 4. It resolves import/export
relationships between components, verifies contract compatibility
(via torvyn-contracts), checks capability grants, handles diamond
dependencies, and produces a LinkedPipeline for instantiation.
§Architecture
The linking process has five phases:
- Topology validation — structural DAG checks (cycles, connectivity, roles).
- Topological ordering — compute processing order.
- Import resolution — match each import to a provider.
- Capability checking — verify capability grants satisfy requirements.
- Pipeline construction — build the
LinkedPipelineoutput.
All code in this crate is COLD PATH — it runs once at pipeline startup, not during stream processing.
§Usage
use torvyn_linker::{PipelineLinker, PipelineTopology, TopologyNode, TopologyEdge};
use torvyn_types::ComponentRole;
let mut topo = PipelineTopology::new("my-pipeline".into());
topo.add_node(TopologyNode {
name: "src".into(),
role: ComponentRole::Source,
artifact_path: "src.wasm".into(),
config: None,
capability_grants: vec![],
});
topo.add_node(TopologyNode {
name: "snk".into(),
role: ComponentRole::Sink,
artifact_path: "snk.wasm".into(),
config: None,
capability_grants: vec![],
});
topo.add_edge(TopologyEdge {
from_node: "src".into(),
from_port: "output".into(),
to_node: "snk".into(),
to_port: "input".into(),
queue_depth: 64,
backpressure_policy: Default::default(),
});
let mut linker = PipelineLinker::new();
let linked = linker.link_topology_only(&topo).unwrap();
assert_eq!(linked.component_count(), 2);Re-exports§
pub use error::LinkDiagnostic;pub use error::LinkDiagnosticCategory;pub use error::LinkReport;pub use error::LinkerError;pub use linked_pipeline::LinkedComponent;pub use linked_pipeline::LinkedConnection;pub use linked_pipeline::LinkedPipeline;pub use linker::PipelineLinker;pub use resolver::ComponentResolution;pub use resolver::ImportResolution;pub use resolver::PipelineResolution;pub use topology::CapabilityGrant;pub use topology::PipelineTopology;pub use topology::TopologyEdge;pub use topology::TopologyNode;pub use topology::DEFAULT_MAX_FAN_IN;pub use topology::DEFAULT_MAX_FAN_OUT;
Modules§
- error
- Linker error types for the Torvyn runtime.
- linked_
pipeline - Linked pipeline representation — the output of the linking process.
- linker
- Top-level pipeline linking orchestrator.
- resolver
- Import/export resolution for component linking.
- topology
- Pipeline topology definition and validation.