Skip to content

Commit 9736310

Browse files
committed
feat: adjusted provider interface to match node execution result
1 parent 39f87ac commit 9736310

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

crates/taurus-core/src/runtime/remote/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! trait without coupling the core engine to a specific transport.
55
66
use async_trait::async_trait;
7-
use tucana::{aquila::ActionExecutionRequest, shared::Value};
7+
use tucana::{aquila::ActionExecutionRequest, shared::{NodeExecutionResult}};
88

99
use crate::types::errors::runtime_error::RuntimeError;
1010

@@ -19,5 +19,5 @@ pub struct RemoteExecution {
1919
#[async_trait]
2020
pub trait RemoteRuntime {
2121
/// Execute a remote node invocation and return its resulting value.
22-
async fn execute_remote(&self, execution: RemoteExecution) -> Result<Value, RuntimeError>;
22+
async fn execute_remote(&self, execution: RemoteExecution) -> Result<NodeExecutionResult, RuntimeError>;
2323
}

crates/taurus-provider/src/providers/remote/nats_remote_runtime.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use taurus_core::runtime::remote::{RemoteExecution, RemoteRuntime};
44
use taurus_core::types::errors::runtime_error::RuntimeError;
55
use tonic::async_trait;
66
use tucana::aquila::ActionExecutionResponse;
7-
use tucana::shared::Value;
7+
use tucana::shared::{NodeExecutionResult};
88

99
pub struct NATSRemoteRuntime {
1010
client: Client,
@@ -18,7 +18,7 @@ impl NATSRemoteRuntime {
1818

1919
#[async_trait]
2020
impl RemoteRuntime for NATSRemoteRuntime {
21-
async fn execute_remote(&self, execution: RemoteExecution) -> Result<Value, RuntimeError> {
21+
async fn execute_remote(&self, execution: RemoteExecution) -> Result<NodeExecutionResult, RuntimeError> {
2222
let topic = format!(
2323
"action.{}.{}",
2424
execution.target_service, execution.request.execution_identifier
@@ -43,8 +43,18 @@ impl RemoteRuntime for NATSRemoteRuntime {
4343
};
4444

4545
let decode_result = ActionExecutionResponse::decode(message.payload);
46-
let _execution_result = match decode_result {
47-
Ok(r) => r,
46+
match decode_result {
47+
Ok(r) => match r.node_result {
48+
Some(res) => Ok(res),
49+
None => {
50+
log::error!("RemoteRuntimeExeption: recieved execution result without an body");
51+
return Err(RuntimeError::new(
52+
"T-PROV-000003",
53+
"RemoteRuntimeExeption",
54+
"Recieved empty action execution response",
55+
));
56+
},
57+
},
4858
Err(err) => {
4959
log::error!(
5060
"RemoteRuntimeExeption: failed to decode NATS message: {}",
@@ -56,8 +66,6 @@ impl RemoteRuntime for NATSRemoteRuntime {
5666
"Failed to read Remote Response",
5767
));
5868
}
59-
};
60-
61-
unimplemented!("Taurus needs to handle text executions (issue nr #185)")
69+
}
6270
}
6371
}

0 commit comments

Comments
 (0)