Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions capnp-rpc/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ impl ResultsHook for Results {
}
}

fn set_pipeline(&mut self, pipeline: Box<dyn PipelineHook>) {
todo!()
}

fn on_tail_call(&mut self) -> Promise<any_pointer::Pipeline, crate::Error> {
todo!()
}

fn tail_call(self: Box<Self>, _request: Box<dyn RequestHook>) -> Promise<(), Error> {
unimplemented!()
}
Expand Down
16 changes: 14 additions & 2 deletions capnp-rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,7 @@ where
variant: Option<ResultsVariant>,
redirect_results: bool,
answer_id: AnswerId,
tail_call_pipeline_fulfiller: Option<oneshot::Sender<any_pointer::Pipeline>>,
finish_received: Rc<Cell<bool>>,
}

Expand Down Expand Up @@ -2203,6 +2204,7 @@ where
redirect_results,
answer_id,
finish_received,
tail_call_pipeline_fulfiller: None,
}),
results_done_fulfiller: Some(fulfiller),
}
Expand Down Expand Up @@ -2250,8 +2252,18 @@ impl<VatId> ResultsHook for Results<VatId> {
}
}

fn tail_call(self: Box<Self>, _request: Box<dyn RequestHook>) -> Promise<(), Error> {
unimplemented!()
fn set_pipeline(&mut self, pipeline: Box<dyn PipelineHook>) {
todo!()
}

fn on_tail_call(&mut self) -> Promise<any_pointer::Pipeline, crate::Error> {
todo!()
}

fn tail_call(self: Box<Self>, request: Box<dyn RequestHook>) -> Promise<(), Error> {
let (promise, pipeline) = self.direct_tail_call(request);
// TODO somehow send pipeline to tail_call_pipeline_fulfiller
promise
}

fn direct_tail_call(
Expand Down
11 changes: 10 additions & 1 deletion capnp/src/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ pub struct Results<T> {
#[cfg(feature = "alloc")]
impl<T> Results<T>
where
T: Owned,
T: Owned + Pipelined,
{
pub fn new(hook: alloc::boxed::Box<dyn ResultsHook>) -> Self {
Self {
Expand All @@ -263,6 +263,15 @@ where
pub fn set(&mut self, other: T::Reader<'_>) -> crate::Result<()> {
self.hook.get().unwrap().set_as(other)
}

pub fn set_pipeline(&mut self, pipeline: T::Pipeline) {
// How do we get a PipelineHook out of `pipeline`?
//self.hook.set_pipeline(pipeline)
}

pub fn tail_call<SubParams>(self, tail_request: Request<SubParams, T>) -> Promise<(), Error> {
self.hook.tail_call(tail_request.hook)
}
}

pub trait FromTypelessPipeline {
Expand Down
6 changes: 6 additions & 0 deletions capnp/src/private/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,16 @@ impl Clone for alloc::boxed::Box<dyn ClientHook> {
pub trait ResultsHook {
fn get(&mut self) -> crate::Result<any_pointer::Builder<'_>>;
fn allow_cancellation(&self);

fn tail_call(
self: alloc::boxed::Box<Self>,
request: alloc::boxed::Box<dyn RequestHook>,
) -> Promise<(), crate::Error>;

fn set_pipeline(&mut self, pipeline: Box<dyn PipelineHook>);

fn on_tail_call(&mut self) -> Promise<any_pointer::Pipeline, crate::Error>;

fn direct_tail_call(
self: alloc::boxed::Box<Self>,
request: alloc::boxed::Box<dyn RequestHook>,
Expand Down