Files
ingey/src/graph/dynamic.rs
vato007 65d1e9fec4
All checks were successful
test / test (push) Successful in 15m58s
Add initial reduction node implementation, start adding dynamic node
2025-01-09 13:55:01 +10:30

38 lines
1.2 KiB
Rust

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(())
}
}