@@ -9,8 +9,8 @@ use std::time::Duration;
99use tokio:: sync:: { Mutex , mpsc, oneshot} ;
1010use uuid:: Uuid ;
1111
12+ use super :: comms;
1213use super :: ext;
13- use super :: http;
1414use super :: loader;
1515
1616static HEAP_LIMIT : usize = 64 * 1024 * 1024 ; // 64MB
@@ -23,12 +23,12 @@ static USER_MOD_SPECIFIER: LazyLock<Url> =
2323 LazyLock :: new ( || "func:user-code" . parse ( ) . expect ( "bad module specifier" ) ) ;
2424
2525pub struct State {
26- pub req : Option < http :: Request > ,
27- pub res : Option < http :: Response > ,
26+ pub req : Option < comms :: Request > ,
27+ pub res : Option < comms :: Response > ,
2828 pub request_id : Uuid ,
2929 pub incoming_body_rx : Rc < Mutex < mpsc:: Receiver < Result < bytes:: Bytes , String > > > > ,
3030 pub outgoing_body_tx : mpsc:: Sender < bytes:: Bytes > ,
31- pub response_tx : Option < oneshot:: Sender < http :: Response > > ,
31+ pub response_tx : Option < oneshot:: Sender < comms :: Response > > ,
3232}
3333
3434pub struct Sandbox {
@@ -40,19 +40,17 @@ impl Sandbox {
4040 pub fn new (
4141 request_id : Uuid ,
4242 startup_snapshot : Option < & ' static [ u8 ] > ,
43- incoming_body_rx : mpsc:: Receiver < Result < bytes:: Bytes , String > > ,
44- outgoing_body_tx : mpsc:: Sender < bytes:: Bytes > ,
45- response_tx : oneshot:: Sender < http:: Response > ,
43+ channels : comms:: Channels ,
4644 ) -> Result < Self > {
4745 _ = CryptoProvider :: install_default ( aws_lc_rs:: default_provider ( ) ) ;
4846
4947 let state = Rc :: new ( RefCell :: new ( State {
5048 request_id,
5149 req : None ,
5250 res : None ,
53- incoming_body_rx : Rc :: new ( Mutex :: new ( incoming_body_rx) ) ,
54- outgoing_body_tx,
55- response_tx : Some ( response_tx) ,
51+ incoming_body_rx : Rc :: new ( Mutex :: new ( channels . incoming_body_rx ) ) ,
52+ outgoing_body_tx : channels . outgoing_body_tx ,
53+ response_tx : Some ( channels . response_tx ) ,
5654 } ) ) ;
5755
5856 let extension_transpiler = Rc :: new ( loader:: transpile) ;
@@ -86,7 +84,7 @@ impl Sandbox {
8684 pub async fn execute (
8785 & mut self ,
8886 user_code : String ,
89- request : http :: Request ,
87+ request : comms :: Request ,
9088 timeout_duration : Duration ,
9189 ) -> Result < ( ) > {
9290 let execution_result = tokio:: time:: timeout ( timeout_duration, async {
0 commit comments