add raw-aquamarine-api feature for AquamarineVM

This commit is contained in:
vms 2020-10-29 23:04:57 +03:00
parent bfc69c8104
commit 4ccce8f5c5
2 changed files with 33 additions and 0 deletions

View File

@ -16,3 +16,7 @@ fluence-faas = { path = "../fluence-faas", version = "0.1.10" }
maplit = "1.0.2"
serde_json = "1.0.57"
serde = "1.0.116"
[features]
# enable raw AquamarineVM API intended for testing
raw-aquamarine-api = []

View File

@ -208,3 +208,32 @@ impl AquamarineVM {
}
}
}
// This API is intended for testing purposes
#[cfg(feature = "raw-aquamarine-api")]
impl AppService {
pub fn call(
&mut self,
init_user_id: impl Into<String>,
aqua: impl Into<String>,
prev_data: impl Into<String>,
data: impl Into<String>,
) -> Result<StepperOutcome> {
let args = vec![
IValue::String(init_user_id.into()),
IValue::String(aqua.into()),
IValue::String(prev_data.into()),
IValue::String(data.into()),
];
let result = self.faas.call_with_ivalues(
AQUAMARINE_WASM_FILE_NAME,
"invoke",
&args,
<_>::default(),
)?;
let raw_outcome = Self::make_raw_outcome(result)?;
raw_outcome.try_into()
}
}