Add initial reduction node implementation, start adding dynamic node
All checks were successful
test / test (push) Successful in 15m58s
All checks were successful
test / test (push) Successful in 15m58s
This commit is contained in:
38
src/graph/dynamic.rs
Normal file
38
src/graph/dynamic.rs
Normal 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(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user