Mountain/Environment/
IPCProvider.rs

1//! # IPCProvider Implementation
2//!
3//! Implements the `IPCProvider` trait for the `MountainEnvironment`. This
4//! provider serves as a simple bridge, delegating all IPC operations directly
5//! to the `Vine` gRPC client.
6
7#![allow(non_snake_case, non_camel_case_types)]
8
9use Common::{Error::CommonError::CommonError, IPC::IPCProvider::IPCProvider};
10use async_trait::async_trait;
11use serde_json::Value;
12
13use super::MountainEnvironment::MountainEnvironment;
14use crate::Vine::Client;
15
16#[async_trait]
17impl IPCProvider for MountainEnvironment {
18	/// Sends a fire-and-forget notification to a specified sidecar.
19	async fn SendNotificationToSideCar(
20		&self,
21
22		SideCarIdentifier:String,
23
24		Method:String,
25
26		Parameters:Value,
27	) -> Result<(), CommonError> {
28		Client::SendNotification(SideCarIdentifier, Method, Parameters)
29			.await
30			.map_err(|Error| CommonError::IPCError { Description:Error.to_string() })
31	}
32
33	/// Sends a request to a specified sidecar and awaits a response.
34	async fn SendRequestToSideCar(
35		&self,
36
37		SideCarIdentifier:String,
38
39		Method:String,
40
41		Parameters:Value,
42
43		TimeoutMilliseconds:u64,
44	) -> Result<Value, CommonError> {
45		Client::SendRequest(&SideCarIdentifier, Method, Parameters, TimeoutMilliseconds)
46			.await
47			.map_err(|Error| CommonError::IPCError { Description:Error.to_string() })
48	}
49}