jjs-dev/commons

rpc: Tx projections

Opened this issue · 1 comments

StreamingTx should have a method like as_event, with roughly following API (trait bounds and errors omitted):

impl<E, F> StreamingTx<E, F> {
    pub fn as_event_sender(&mut self) -> EventSender<E, F>;
}

pub struct EventSender<'a, E>(&'a mut StreamingTx<E, F>);

impl<E> EventSender<E>{ 
    pub async fn send_event(&mut self, ev: E);
   // note - no `finish` method
}

Also, EventSender should not have F generic parameter.