ThriftService

Trait ThriftService 

Source
pub trait ThriftService<F>:
    Send
    + Sync
    + 'static
where F: Framing + Send + 'static,
{ type Handler; type RequestContext; type ReplyState; // Required methods fn call<'life0, 'life1, 'async_trait>( &'life0 self, req: FramingDecoded<F>, req_ctxt: &'life1 Self::RequestContext, reply_state: Arc<Mutex<Self::ReplyState>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_method_names(&self) -> &'static [&'static str]; fn on_termination<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn create_interaction( &self, _name: &str, ) -> Result<Arc<dyn ThriftService<F, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + Send + 'static>> { ... } }

Required Associated Types§

Required Methods§

Source

fn call<'life0, 'life1, 'async_trait>( &'life0 self, req: FramingDecoded<F>, req_ctxt: &'life1 Self::RequestContext, reply_state: Arc<Mutex<Self::ReplyState>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_method_names(&self) -> &'static [&'static str]

Returns function names this thrift service is able to handle, similar to the keys of C++’s createMethodMetadata().

Return value includes inherited functions from parent thrift services, and interactions’ functions.

Source

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

Applies to interactions only

Termination callback is invoked immediately as soon as the client’s termination signal is received. This differs to the interaction service being dropped, which only happens when all outstanding requests and streams have been completed. This is not invoked if the connection closes without the signal being received.

Provided Methods§

Source

fn create_interaction( &self, _name: &str, ) -> Result<Arc<dyn ThriftService<F, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + Send + 'static>>

Implementations on Foreign Types§

Source§

impl<F, T> ThriftService<F> for Box<T>
where T: ThriftService<F> + Send + Sync + ?Sized, F: Framing + Send + 'static, T::RequestContext: Send + Sync + 'static, T::ReplyState: Send + Sync + 'static,

Source§

type Handler = <T as ThriftService<F>>::Handler

Source§

type RequestContext = <T as ThriftService<F>>::RequestContext

Source§

type ReplyState = <T as ThriftService<F>>::ReplyState

Source§

fn call<'life0, 'life1, 'async_trait>( &'life0 self, req: FramingDecoded<F>, req_ctxt: &'life1 Self::RequestContext, reply_state: Arc<Mutex<Self::ReplyState>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn create_interaction( &self, name: &str, ) -> Result<Arc<dyn ThriftService<F, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + Send + 'static>>

Source§

fn get_method_names(&self) -> &'static [&'static str]

Source§

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

Source§

impl<F, T> ThriftService<F> for Arc<T>
where T: ThriftService<F> + Send + Sync + ?Sized, F: Framing + Send + 'static, T::RequestContext: Send + Sync + 'static, T::ReplyState: Send + Sync + 'static,

Source§

type Handler = <T as ThriftService<F>>::Handler

Source§

type RequestContext = <T as ThriftService<F>>::RequestContext

Source§

type ReplyState = <T as ThriftService<F>>::ReplyState

Source§

fn call<'life0, 'life1, 'async_trait>( &'life0 self, req: FramingDecoded<F>, req_ctxt: &'life1 Self::RequestContext, reply_state: Arc<Mutex<Self::ReplyState>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn create_interaction( &self, name: &str, ) -> Result<Arc<dyn ThriftService<F, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + Send + 'static>>

Source§

fn get_method_names(&self) -> &'static [&'static str]

Source§

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

Implementors§

Source§

impl<P, R, RS> ThriftService<<P as Protocol>::Frame> for NullServiceProcessor<P, R, RS>
where P: Protocol + Send + Sync + 'static, P::Frame: Send + 'static, R: RequestContext<Name = CStr> + Send + Sync + 'static, R::ContextStack: ContextStack<Name = CStr>, RS: ReplyState<P::Frame> + Send + Sync + 'static,