mirror of
https://github.com/fluencelabs/aquavm
synced 2025-04-24 23:02:16 +00:00
little fixes
This commit is contained in:
parent
4100c986c7
commit
86c691bd4a
@ -9,3 +9,6 @@ modules_dir = "./target/wasm32-wasi/release/"
|
||||
name = "aquamarine"
|
||||
mem_pages_count = 100
|
||||
logger_enabled = true
|
||||
|
||||
[module.wasi]
|
||||
envs = ["CURRENT_PEER_ID=asd"]
|
||||
|
@ -50,11 +50,12 @@ pub enum FunctionPart {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub(crate) struct Call(PeerPart, FunctionPart, Vec<String>, String);
|
||||
|
||||
impl super::ExecutableInstruction for Call {
|
||||
fn execute(self, data: &mut AquaData, next_peer_pks: &mut Vec<String>) -> Result<()> {
|
||||
log::info!("call called with data: {:?} and next_peer_pks: {:?}", data, next_peer_pks);
|
||||
|
||||
let (peer_pk, service_id, func_name) = parse_peer_fn_parts(self.0, self.1)?;
|
||||
let function_args = parse_args(self.2, data)?;
|
||||
let function_args = serde_json::to_string(&function_args)?;
|
||||
|
@ -28,7 +28,7 @@ use serde_derive::Deserialize;
|
||||
use serde_derive::Serialize;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
#[serde(untagged)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub(crate) enum Instruction {
|
||||
Null(Null),
|
||||
Call(Call),
|
||||
|
@ -21,11 +21,12 @@ use serde_derive::Deserialize;
|
||||
use serde_derive::Serialize;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub(crate) struct Null {}
|
||||
|
||||
impl super::ExecutableInstruction for Null {
|
||||
fn execute(self, _data: &mut AquaData, _next_peer_pks: &mut Vec<String>) -> Result<()> {
|
||||
fn execute(self, data: &mut AquaData, next_peer_pks: &mut Vec<String>) -> Result<()> {
|
||||
log::info!("null called with data: {:?} and next_peer_pks: {:?}", data, next_peer_pks);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ fn execute_aqua_impl(init_user_id: String, aqua: String, data: String) -> Result
|
||||
parsed_data
|
||||
);
|
||||
|
||||
super::stepper::execute(parsed_aqua, &mut parsed_data)?;
|
||||
let next_peer_pks = super::stepper::execute(parsed_aqua, &mut parsed_data)?;
|
||||
let data = serde_json::to_string(&parsed_data)?;
|
||||
|
||||
Ok(StepperOutcome {
|
||||
ret_code: 0,
|
||||
data,
|
||||
next_peer_pks: vec![init_user_id],
|
||||
next_peer_pks,
|
||||
})
|
||||
}
|
||||
|
@ -17,6 +17,6 @@ pub fn call_service(service_id: String, fn_name: String, args: String) -> CallSe
|
||||
|
||||
CallServiceResult {
|
||||
ret_code: 0,
|
||||
result: args,
|
||||
result: String::from("[\"args\"]"),
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user