use std::collections::HashMap;
use std::path::Path;
use std::sync::Arc;
use crate::module::ipc::protocol::{CliSpec, InvocationResultPayload};
use crate::module::traits::ModuleError;
pub trait WasmModuleInstance: Send + Sync {
fn invoke_cli(
&self,
subcommand: &str,
args: Vec<String>,
) -> Result<InvocationResultPayload, ModuleError>;
fn invoke_rpc(
&self,
method: &str,
params: serde_json::Value,
) -> Result<serde_json::Value, ModuleError>;
fn cli_spec(&self) -> Option<CliSpec>;
}
pub trait WasmModuleLoader: Send + Sync {
fn load(
&self,
path: &Path,
data_dir: &Path,
config: HashMap<String, String>,
) -> Result<Arc<dyn WasmModuleInstance>, String>;
}