mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-10 06:38:22 +00:00
Revert "wapm2pirita nests all annotations under a key with the same name as the runner"
This reverts commit 83bec095cf.
This commit is contained in:
@@ -151,10 +151,9 @@ impl crate::runners::Runner for WasiRunner {
|
|||||||
command: &Command,
|
command: &Command,
|
||||||
container: &WapmContainer,
|
container: &WapmContainer,
|
||||||
) -> Result<Self::Output, Error> {
|
) -> Result<Self::Output, Error> {
|
||||||
let Annotations { wasi } = command
|
let wasi = command
|
||||||
.get_annotation(webc::metadata::annotations::WASI_RUNNER_URI)?
|
.get_annotation("wasi")?
|
||||||
.unwrap_or_default();
|
.unwrap_or_else(|| Wasi::new(command_name));
|
||||||
let wasi = wasi.unwrap_or_else(|| Wasi::new(command_name));
|
|
||||||
let atom_name = &wasi.atom;
|
let atom_name = &wasi.atom;
|
||||||
let atom = container
|
let atom = container
|
||||||
.get_atom(atom_name)
|
.get_atom(atom_name)
|
||||||
@@ -169,8 +168,3 @@ impl crate::runners::Runner for WasiRunner {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, serde::Deserialize)]
|
|
||||||
struct Annotations {
|
|
||||||
wasi: Option<Wasi>,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -41,20 +41,17 @@ impl WcgiRunner {
|
|||||||
|
|
||||||
#[tracing::instrument(skip(self, ctx))]
|
#[tracing::instrument(skip(self, ctx))]
|
||||||
fn run(&mut self, command_name: &str, ctx: &RunnerContext<'_>) -> Result<(), Error> {
|
fn run(&mut self, command_name: &str, ctx: &RunnerContext<'_>) -> Result<(), Error> {
|
||||||
let key = webc::metadata::annotations::WCGI_RUNNER_URI;
|
let wasi: Wasi = ctx
|
||||||
let Annotations { wasi, wcgi } = ctx
|
|
||||||
.command()
|
.command()
|
||||||
.get_annotation(key)
|
.get_annotation("wasi")
|
||||||
.with_context(|| format!("Unable to deserialize the \"{key}\" annotations"))?
|
.context("Unable to retrieve the WASI metadata")?
|
||||||
.unwrap_or_default();
|
.unwrap_or_else(|| Wasi::new(command_name));
|
||||||
|
|
||||||
let wasi = wasi.unwrap_or_else(|| Wasi::new(command_name));
|
|
||||||
|
|
||||||
let module = self
|
let module = self
|
||||||
.load_module(&wasi, ctx)
|
.load_module(&wasi, ctx)
|
||||||
.context("Couldn't load the module")?;
|
.context("Couldn't load the module")?;
|
||||||
|
|
||||||
let handler = self.create_handler(module, &wasi, &wcgi, ctx)?;
|
let handler = self.create_handler(module, &wasi, ctx)?;
|
||||||
let task_manager = Arc::clone(&handler.task_manager);
|
let task_manager = Arc::clone(&handler.task_manager);
|
||||||
let callbacks = Arc::clone(&self.config.callbacks);
|
let callbacks = Arc::clone(&self.config.callbacks);
|
||||||
|
|
||||||
@@ -129,10 +126,11 @@ impl WcgiRunner {
|
|||||||
&self,
|
&self,
|
||||||
module: Module,
|
module: Module,
|
||||||
wasi: &Wasi,
|
wasi: &Wasi,
|
||||||
wcgi: &Wcgi,
|
|
||||||
ctx: &RunnerContext<'_>,
|
ctx: &RunnerContext<'_>,
|
||||||
) -> Result<Handler, Error> {
|
) -> Result<Handler, Error> {
|
||||||
let dialect = match &wcgi.dialect {
|
let Wcgi { dialect, .. } = ctx.command().get_annotation("wcgi")?.unwrap_or_default();
|
||||||
|
|
||||||
|
let dialect = match dialect {
|
||||||
Some(d) => d.parse().context("Unable to parse the CGI dialect")?,
|
Some(d) => d.parse().context("Unable to parse the CGI dialect")?,
|
||||||
None => CgiDialect::Wcgi,
|
None => CgiDialect::Wcgi,
|
||||||
};
|
};
|
||||||
@@ -344,13 +342,6 @@ impl Default for Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, serde::Deserialize)]
|
|
||||||
struct Annotations {
|
|
||||||
wasi: Option<Wasi>,
|
|
||||||
#[serde(default)]
|
|
||||||
wcgi: Wcgi,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Callbacks that are triggered at various points in the lifecycle of a runner
|
/// Callbacks that are triggered at various points in the lifecycle of a runner
|
||||||
/// and any WebAssembly instances it may start.
|
/// and any WebAssembly instances it may start.
|
||||||
pub trait Callbacks: Send + Sync + 'static {
|
pub trait Callbacks: Send + Sync + 'static {
|
||||||
|
|||||||
Reference in New Issue
Block a user