@@ -7,7 +7,6 @@ use std::{collections::HashSet, sync::Arc};
77use tokio:: io:: { ReadHalf , SimplexStream , WriteHalf } ;
88use tokio:: sync:: mpsc;
99use tokio:: sync:: RwLock ;
10- use wasmtime_wasi:: WasiView ;
1110
1211pub use bs:: types:: Error ;
1312
@@ -127,33 +126,18 @@ pub trait Finishable: Send + Sync {
127126pub struct BlobStoreDispatch < ' a > {
128127 allowed_containers : HashSet < String > ,
129128 manager : Arc < dyn ContainerManager > ,
130- wasi : wasmtime_wasi :: WasiImpl < WasiImplInner < ' a > > ,
129+ wasi_resources : & ' a mut ResourceTable ,
131130 containers : Arc < RwLock < Table < Arc < dyn Container > > > > ,
132131 incoming_values : Arc < RwLock < Table < Box < dyn IncomingData > > > > ,
133132 outgoing_values : Arc < RwLock < Table < OutgoingValue > > > ,
134133 object_names : Arc < RwLock < Table < Box < dyn ObjectNames > > > > ,
135134}
136135
137- pub struct WasiImplInner < ' a > {
138- pub ctx : & ' a mut wasmtime_wasi:: WasiCtx ,
139- pub table : & ' a mut ResourceTable ,
140- }
141-
142- impl wasmtime_wasi:: WasiView for WasiImplInner < ' _ > {
143- fn ctx ( & mut self ) -> & mut wasmtime_wasi:: WasiCtx {
144- self . ctx
145- }
146-
147- fn table ( & mut self ) -> & mut ResourceTable {
148- self . table
149- }
150- }
151-
152136impl < ' a > BlobStoreDispatch < ' a > {
153137 pub ( crate ) fn new (
154138 allowed_containers : HashSet < String > ,
155139 manager : Arc < dyn ContainerManager > ,
156- wasi : wasmtime_wasi :: WasiImpl < WasiImplInner < ' a > > ,
140+ wasi_resources : & ' a mut ResourceTable ,
157141 containers : Arc < RwLock < Table < Arc < dyn Container > > > > ,
158142 incoming_values : Arc < RwLock < Table < Box < dyn IncomingData > > > > ,
159143 outgoing_values : Arc < RwLock < Table < OutgoingValue > > > ,
@@ -162,7 +146,7 @@ impl<'a> BlobStoreDispatch<'a> {
162146 Self {
163147 allowed_containers,
164148 manager,
165- wasi ,
149+ wasi_resources ,
166150 containers,
167151 incoming_values,
168152 outgoing_values,
@@ -275,7 +259,7 @@ impl bs::types::HostIncomingValue for BlobStoreDispatch<'_> {
275259 let mut incoming = self . take_incoming_value ( self_) . await ?;
276260 let async_body = incoming. as_mut ( ) . consume_async ( ) ;
277261 let host_stm: Box < dyn wasmtime_wasi:: HostInputStream > = Box :: new ( async_body) ;
278- let resource = self . wasi . table ( ) . push ( host_stm) . unwrap ( ) ;
262+ let resource = self . wasi_resources . push ( host_stm) . unwrap ( ) ;
279263 Ok ( resource)
280264 }
281265
@@ -316,7 +300,7 @@ impl bs::types::HostOutgoingValue for BlobStoreDispatch<'_> {
316300 let stm = outgoing. write_stream ( ) ?;
317301
318302 let host_stm: Box < dyn wasmtime_wasi:: HostOutputStream > = Box :: new ( stm) ;
319- let resource = self . wasi . table ( ) . push ( host_stm) . unwrap ( ) ;
303+ let resource = self . wasi_resources . push ( host_stm) . unwrap ( ) ;
320304
321305 Ok ( Ok ( resource) )
322306 }
0 commit comments