Skip to content

Commit 39b91ea

Browse files
committed
start trying to implement tail_call() and set_pipeline()
1 parent 6c2d95b commit 39b91ea

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

capnp-rpc/src/local.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ impl ResultsHook for Results {
126126
}
127127
}
128128

129+
fn on_tail_call(&mut self) -> Promise<any_pointer::Pipeline, crate::Error> {
130+
todo!()
131+
}
132+
129133
fn tail_call(self: Box<Self>, _request: Box<dyn RequestHook>) -> Promise<(), Error> {
130134
unimplemented!()
131135
}

capnp-rpc/src/rpc.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,7 @@ where
21762176
variant: Option<ResultsVariant>,
21772177
redirect_results: bool,
21782178
answer_id: AnswerId,
2179+
tail_call_pipeline_fulfiller: Option<oneshot::Sender<any_pointer::Pipeline>>,
21792180
finish_received: Rc<Cell<bool>>,
21802181
}
21812182

@@ -2239,6 +2240,7 @@ where
22392240
redirect_results,
22402241
answer_id,
22412242
finish_received,
2243+
tail_call_pipeline_fulfiller: None,
22422244
}),
22432245
results_done_fulfiller: Some(fulfiller),
22442246
}
@@ -2293,8 +2295,14 @@ impl<VatId> ResultsHook for Results<VatId> {
22932295
}
22942296
}
22952297

2296-
fn tail_call(self: Box<Self>, _request: Box<dyn RequestHook>) -> Promise<(), Error> {
2297-
unimplemented!()
2298+
fn on_tail_call(&mut self) -> Promise<any_pointer::Pipeline, crate::Error> {
2299+
todo!()
2300+
}
2301+
2302+
fn tail_call(self: Box<Self>, request: Box<dyn RequestHook>) -> Promise<(), Error> {
2303+
let (promise, pipeline) = self.direct_tail_call(request);
2304+
// TODO somehow send pipeline to tail_call_pipeline_fulfiller
2305+
promise
22982306
}
22992307

23002308
fn direct_tail_call(

capnp/src/capability.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ where
239239
pub fn set(&mut self, other: T::Reader<'_>) -> crate::Result<()> {
240240
self.hook.get().unwrap().set_as(other)
241241
}
242+
243+
pub fn tail_call<SubParams>(self, tail_request: Request<SubParams, T>)
244+
-> Promise<(), Error>
245+
{
246+
self.hook.tail_call(tail_request.hook)
247+
}
242248
}
243249

244250
pub trait FromTypelessPipeline {

capnp/src/private/capability.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ impl Clone for Box<dyn ClientHook> {
9494
pub trait ResultsHook {
9595
fn get(&mut self) -> crate::Result<any_pointer::Builder<'_>>;
9696
fn allow_cancellation(&self);
97+
98+
fn on_tail_call(&mut self) -> Promise<any_pointer::Pipeline, crate::Error>;
99+
97100
fn tail_call(self: Box<Self>, request: Box<dyn RequestHook>) -> Promise<(), crate::Error>;
98101
fn direct_tail_call(
99102
self: Box<Self>,

0 commit comments

Comments
 (0)