@@ -7,7 +7,6 @@ use std::{collections::HashSet, sync::Arc};
7
7
use tokio:: io:: { ReadHalf , SimplexStream , WriteHalf } ;
8
8
use tokio:: sync:: mpsc;
9
9
use tokio:: sync:: RwLock ;
10
- use wasmtime_wasi:: WasiView ;
11
10
12
11
pub use bs:: types:: Error ;
13
12
@@ -127,33 +126,18 @@ pub trait Finishable: Send + Sync {
127
126
pub struct BlobStoreDispatch < ' a > {
128
127
allowed_containers : HashSet < String > ,
129
128
manager : Arc < dyn ContainerManager > ,
130
- wasi : wasmtime_wasi :: WasiImpl < WasiImplInner < ' a > > ,
129
+ wasi_resources : & ' a mut ResourceTable ,
131
130
containers : Arc < RwLock < Table < Arc < dyn Container > > > > ,
132
131
incoming_values : Arc < RwLock < Table < Box < dyn IncomingData > > > > ,
133
132
outgoing_values : Arc < RwLock < Table < OutgoingValue > > > ,
134
133
object_names : Arc < RwLock < Table < Box < dyn ObjectNames > > > > ,
135
134
}
136
135
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
-
152
136
impl < ' a > BlobStoreDispatch < ' a > {
153
137
pub ( crate ) fn new (
154
138
allowed_containers : HashSet < String > ,
155
139
manager : Arc < dyn ContainerManager > ,
156
- wasi : wasmtime_wasi :: WasiImpl < WasiImplInner < ' a > > ,
140
+ wasi_resources : & ' a mut ResourceTable ,
157
141
containers : Arc < RwLock < Table < Arc < dyn Container > > > > ,
158
142
incoming_values : Arc < RwLock < Table < Box < dyn IncomingData > > > > ,
159
143
outgoing_values : Arc < RwLock < Table < OutgoingValue > > > ,
@@ -162,7 +146,7 @@ impl<'a> BlobStoreDispatch<'a> {
162
146
Self {
163
147
allowed_containers,
164
148
manager,
165
- wasi ,
149
+ wasi_resources ,
166
150
containers,
167
151
incoming_values,
168
152
outgoing_values,
@@ -275,7 +259,7 @@ impl bs::types::HostIncomingValue for BlobStoreDispatch<'_> {
275
259
let mut incoming = self . take_incoming_value ( self_) . await ?;
276
260
let async_body = incoming. as_mut ( ) . consume_async ( ) ;
277
261
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 ( ) ;
279
263
Ok ( resource)
280
264
}
281
265
@@ -316,7 +300,7 @@ impl bs::types::HostOutgoingValue for BlobStoreDispatch<'_> {
316
300
let stm = outgoing. write_stream ( ) ?;
317
301
318
302
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 ( ) ;
320
304
321
305
Ok ( Ok ( resource) )
322
306
}
0 commit comments