pub struct WASMTransportImpl {
runtime: Arc<WASMRuntime>,
memory_manager: Arc<RwLock<MemoryManagerImpl>>,
bridge: Arc<HostBridgeImpl>,
modules: Arc<RwLock<HashMap<String, WASMModuleInfo>>>,
config: TransportConfig,
connected: Arc<RwLock<bool>>,
stats: Arc<RwLock<TransportStats>>,
}Expand description
WASM transport for direct module communication
Fields§
§runtime: Arc<WASMRuntime>WASM runtime
memory_manager: Arc<RwLock<MemoryManagerImpl>>Memory manager
bridge: Arc<HostBridgeImpl>Host bridge for communication
modules: Arc<RwLock<HashMap<String, WASMModuleInfo>>>Loaded modules
config: TransportConfigTransport configuration
connected: Arc<RwLock<bool>>Connection state
stats: Arc<RwLock<TransportStats>>Transport statistics
Implementations§
Source§impl WASMTransportImpl
impl WASMTransportImpl
Sourcepub fn new(
enable_wasi: bool,
memory_limit_mb: u64,
max_execution_time_ms: u64,
) -> Result<Self>
pub fn new( enable_wasi: bool, memory_limit_mb: u64, max_execution_time_ms: u64, ) -> Result<Self>
Create a new WASM transport with default configuration
Sourcepub fn with_config(
wasm_config: WASMConfig,
transport_config: TransportConfig,
) -> Result<Self>
pub fn with_config( wasm_config: WASMConfig, transport_config: TransportConfig, ) -> Result<Self>
Create a new WASM transport with custom configuration
Sourcepub fn runtime(&self) -> &Arc<WASMRuntime>
pub fn runtime(&self) -> &Arc<WASMRuntime>
Get a reference to the WASM runtime
Sourcepub fn memory_manager(&self) -> &Arc<RwLock<MemoryManagerImpl>>
pub fn memory_manager(&self) -> &Arc<RwLock<MemoryManagerImpl>>
Get a reference to the memory manager
Sourcepub fn bridge(&self) -> &Arc<HostBridgeImpl>
pub fn bridge(&self) -> &Arc<HostBridgeImpl>
Get a reference to the host bridge
Sourcepub async fn get_modules(&self) -> HashMap<String, WASMModuleInfo>
pub async fn get_modules(&self) -> HashMap<String, WASMModuleInfo>
Get all loaded modules
Sourcepub async fn get_wasm_stats(&self) -> WASMStats
pub async fn get_wasm_stats(&self) -> WASMStats
Get WASM runtime statistics
Trait Implementations§
Source§impl Clone for WASMTransportImpl
impl Clone for WASMTransportImpl
Source§fn clone(&self) -> WASMTransportImpl
fn clone(&self) -> WASMTransportImpl
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WASMTransportImpl
impl Debug for WASMTransportImpl
Source§impl TransportStrategy for WASMTransportImpl
impl TransportStrategy for WASMTransportImpl
Source§type Error = WASMTransportError
type Error = WASMTransportError
Error type for this transport
Source§fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to the transport endpoint
Source§fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a request and receive a response
Source§fn send_no_response<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_no_response<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send data without expecting a response (fire and forget)
Source§fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the transport connection
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if the transport is connected
Source§fn transport_type(&self) -> TransportType
fn transport_type(&self) -> TransportType
Get the transport type identifier
Auto Trait Implementations§
impl Freeze for WASMTransportImpl
impl !RefUnwindSafe for WASMTransportImpl
impl Send for WASMTransportImpl
impl Sync for WASMTransportImpl
impl Unpin for WASMTransportImpl
impl !UnwindSafe for WASMTransportImpl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request