Add initial reduction node implementation, start adding dynamic node
All checks were successful
test / test (push) Successful in 15m58s

This commit is contained in:
2025-01-09 13:55:01 +10:30
parent 43db0dc308
commit 65d1e9fec4
6 changed files with 1039 additions and 60 deletions

38
src/graph/dynamic.rs Normal file
View File

@@ -0,0 +1,38 @@
use crate::graph::node::RunnableNode;
use async_trait::async_trait;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use wasmtime::component::{bindgen, Component};
use wasmtime::{Config, Engine, Linker, Store};
bindgen!();
#[derive(Serialize, Deserialize, Clone, JsonSchema)]
pub struct DynamicNode {
pub wasm_file: String,
pub file_paths: Vec<String>,
pub output_file: String,
}
pub struct DynamicNodeRunner {
pub dynamic_node: DynamicNode,
}
#[async_trait]
impl RunnableNode for DynamicNodeRunner {
async fn run(&self) -> anyhow::Result<()> {
let mut config = Config::new();
config.wasm_component_model(true);
let engine = Engine::new(&config)?;
// let component = Component::from_file(&engine, self.dynamic_node.wasm_file.to_owned())?;
// let mut linker = Linker::new(&engine);
// ::add_to_linker(&mut linker, |state: &mut TestState| state)?;
let mut store = Store::new(
&engine,
&self.dynamic_node,
);
// let (bindings, _) = Dynamic::instantiate(&mut store, &component, &linker)?;
// bindings.call_greet(&mut store)?;
Ok(())
}
}