pub trait ThriftService<F>:
Send
+ Sync
+ '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§
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,
Sourcefn get_method_names(&self) -> &'static [&'static str]
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.
Sourcefn on_termination<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.