Skip to main content

Crate sim_lib_topology

Crate sim_lib_topology 

Source
Expand description

Data-driven topology engine.

Topologies are authored as graph data, text wiring, diagrams, or .simtopo packages, then validated and compiled into deterministic runtime plans.

use std::sync::Arc;

use sim_kernel::{Cx, DefaultFactory, Expr, NoopEvalPolicy, Symbol};
use sim_lib_topology::{compile_graph, parse_package, topology_card_expr};

let package = parse_package(
    r#"
graph:
topology doc-flow
node in verb=in
node step verb=wire
node out verb=out
wire in -> step
wire step -> out

tests:
smoke input="ping" expect="ping"
capabilities:
topology/run
"#,
)
.unwrap();

assert_eq!(package.name(), &Symbol::new("doc-flow"));
assert_eq!(package.tests.len(), 1);

let mut cx = Cx::new(Arc::new(NoopEvalPolicy), Arc::new(DefaultFactory));
let plan = compile_graph(&mut cx, &package.graph).unwrap();
assert_eq!(plan.nodes.len(), 3);

let card = topology_card_expr(&Symbol::qualified("topology", "package-format"));
assert!(matches!(card, Expr::Map(_)));

Re-exports§

pub use adapter::TopologyAdapter;
pub use adapter::TopologyAdapterRegistry;
pub use browse::TopologyExampleSpec;
pub use browse::TopologyFunctionSpec;
pub use browse::TopologyVerbSpec;
pub use browse::topology_browse_symbols;
pub use browse::topology_card_expr;
pub use browse::topology_example_specs;
pub use browse::topology_function_specs;
pub use browse::topology_verb_specs;
pub use capability::topology_file_capability;
pub use capability::topology_reflect_capability;
pub use capability::topology_run_capability;
pub use capability::topology_write_capability;
pub use compile::CompiledGraph;
pub use compile::compile_graph;
pub use cookbook::embodied_intelligence_trace_demo;
pub use cookbook::tiny_graph_demo;
pub use instrument::InstrumentTopologyAdapter;
pub use instrument::InstrumentTopologyCord;
pub use instrument::InstrumentTopologyJack;
pub use instrument::InstrumentTopologyModule;
pub use instrument::InstrumentTopologySpec;
pub use model::Budget;
pub use model::BudgetExhausted;
pub use model::Cell;
pub use model::Edge;
pub use model::EdgeId;
pub use model::Graph;
pub use model::GraphTest;
pub use model::Node;
pub use model::NodeId;
pub use model::Port;
pub use model::PortMode;
pub use model::PortRef;
pub use model::Scheduler;
pub use model::SchedulerMode;
pub use package::TopologyPackage;
pub use package::TopologyPackageSource;
pub use package::load_package_file;
pub use package::parse_package;
pub use parse::graph_from_value;
pub use parse::parse_graph;
pub use patch::PatchOp;
pub use patch::TopologyPatch;
pub use patch::apply_topology_patch;
pub use patch::apply_topology_patch_ops;
pub use patch::patched_connection;
pub use place::DomainBridge;
pub use place::PlacedNode;
pub use place::PlacementNodeProfile;
pub use place::PlacementRefusal;
pub use place::PlacementRefusalReason;
pub use place::PlacementReport;
pub use place::PortLatency;
pub use place::SiteId;
pub use place::SiteMap;
pub use place::SiteProfile;
pub use place::place;
pub use place::place_graph;
pub use reflect::ReflectedCell;
pub use reflect::ReflectedNode;
pub use reflect::TopologyEdgeVisit;
pub use reflect::TopologyHistory;
pub use reflect::TopologyRecordedReply;
pub use reflect::TopologyRunReport;
pub use reflect::TopologyVisit;
pub use reflect::topology_explain;
pub use reflect::topology_reflect;
pub use reflect::topology_reflect_graph;
pub use reflect::topology_reflect_run;
pub use registry::SharedTopologyRegistry;
pub use registry::TopologyEntry;
pub use registry::TopologyLib;
pub use registry::TopologyRegistry;
pub use registry::install_topology_lib;
pub use registry::manifest_name as topology_manifest_name;
pub use registry::topology_def;
pub use registry::topology_exports;
pub use registry::topology_get;
pub use registry::topology_list;
pub use registry::topology_load_file;
pub use registry::topology_load_source;
pub use registry::topology_reload;
pub use registry::topology_remove;
pub use registry::topology_site_symbol;
pub use replay::TopologyCounterfactual;
pub use replay::counterfactual_replay;
pub use replay::replay_report;
pub use site::TopologyConnection;
pub use site::connection_from_graph;

Modules§

adapter
Adapter registry and protocol adapters for topology targets.
browse
Agent-facing topology browse, help, and example data.
capability
Capability helpers for topology loading and execution.
compile
Graph validation and lowering to deterministic compile plans.
cookbook
Deterministic cookbook builders for topology recipes.
diagram
ASCII diagram topology parsing.
error
Topology engine error and validation-diagnostic constructors.
instrument
Instrument-style topology specs (modules and cords) lowered to graph data.
model
Public topology graph model: graphs, nodes, edges, ports, cells, budgets.
package
Topology package parsing and loading.
parse
Parsing of canonical expression and list forms into topology graph data.
patch
Topology patch parsing and clone-apply support.
place
Site placement: assigning topology nodes to sites and bridging clock domains.
reflect
Topology graph and run reflection.
registry
Topology registry and file reload support.
replay
Topology replay and counterfactual execution.
run
Topology run-state and sequential core scheduler.
site
TopologySite eval-fabric surface exposing a compiled graph as an endpoint.
text
Tiny line-oriented topology DSL.
validate
Static topology graph validation.
verb
Built-in topology verb execution.

Structs§

TopologyEdgeDescriptor
Citizen object wrapping a validated topology edge expression.
TopologyNodeDescriptor
Citizen object wrapping a validated topology node expression.
TopologyPackageDescriptor
Citizen object wrapping a validated .simtopo package source string.

Statics§

RECIPES
Cookbook recipes for this lib, embedded at build time.

Functions§

topology_edge_class_symbol
Returns the class symbol for topology edge descriptors.
topology_node_class_symbol
Returns the class symbol for topology node descriptors.
topology_package_class_symbol
Returns the class symbol for topology package descriptors.