pub trait ServiceProcessor<P>
where P: Protocol,
{ type RequestContext; type ReplyState; // Required methods fn method_idx(&self, name: &[u8]) -> Result<usize, ApplicationException>; fn handle_method<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, idx: usize, d: &'life1 mut P::Deserializer, req: ProtocolDecoded<P>, req_ctxt: &'life2 Self::RequestContext, reply_state: Arc<Mutex<Self::ReplyState>>, seqid: u32 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn handle_on_termination<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn create_interaction_idx(&self, _name: &str) -> Result<usize> { ... } fn handle_create_interaction( &self, _idx: usize ) -> Result<Arc<dyn ThriftService<P::Frame, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + Send + 'static>> { ... } }
Expand description

Trait implemented by a generated type to implement a service.

Required Associated Types§

Required Methods§

source

fn method_idx(&self, name: &[u8]) -> Result<usize, ApplicationException>

Given a method name, return a reference to the processor for that index.

source

fn handle_method<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, idx: usize, d: &'life1 mut P::Deserializer, req: ProtocolDecoded<P>, req_ctxt: &'life2 Self::RequestContext, reply_state: Arc<Mutex<Self::ReplyState>>, seqid: u32 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Given a method index and the remains of the message input, get a future for the result of the method. This will only be called if the corresponding method_idx() returns an (index, ServiceProcessor) tuple. frame is a reference to the frame containing the request. request is a deserializer instance set up to decode the request.

source

fn handle_on_termination<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

source

fn create_interaction_idx(&self, _name: &str) -> Result<usize>

Given a method name, return a reference to the interaction creation fn for that index

source

fn handle_create_interaction( &self, _idx: usize ) -> Result<Arc<dyn ThriftService<P::Frame, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + Send + 'static>>

Given a creation method index, it produces a fresh interaction processor

Implementors§

source§

impl<P, R, RS> ServiceProcessor<P> for NullServiceProcessor<P, R, RS>
where P: Protocol + Sync, P::Deserializer: Send, R: Sync, RS: Sync + Send,

§

type RequestContext = R

§

type ReplyState = RS