LLVM  6.0.0svn
Public Types | Public Member Functions | List of all members
llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT > Class Template Reference

#include "llvm/ExecutionEngine/Orc/RPCUtils.h"

Inheritance diagram for llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >:
Inheritance graph
[legend]
Collaboration diagram for llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >:
Collaboration graph
[legend]

Public Types

template<typename Func >
using NonBlockingCallResult = typename detail::ResultTraits< typename Func::ReturnType >::ReturnFutureType
 Return type for non-blocking call primitives. More...
 

Public Member Functions

 MultiThreadedRPCEndpoint (ChannelT &C, bool LazyAutoNegotiation)
 
template<typename Func , typename HandlerT >
void addHandler (HandlerT Handler)
 Add a handler for the given RPC function. More...
 
template<typename Func , typename ClassT , typename RetT , typename... ArgTs>
void addHandler (ClassT &Object, RetT(ClassT::*Method)(ArgTs...))
 Add a class-method as a handler. More...
 
template<typename Func , typename HandlerT >
void addAsyncHandler (HandlerT Handler)
 
template<typename Func , typename ClassT , typename RetT , typename... ArgTs>
void addAsyncHandler (ClassT &Object, RetT(ClassT::*Method)(ArgTs...))
 Add a class-method as a handler. More...
 
template<typename Func , typename... ArgTs>
Expected< NonBlockingCallResult< Func > > appendCallNB (const ArgTs &... Args)
 Call Func on Channel C. More...
 
template<typename Func , typename... ArgTs>
Expected< NonBlockingCallResult< Func > > callNB (const ArgTs &... Args)
 The same as appendCallNBWithSeq, except that it calls C.send() to flush the channel after serializing the call. More...
 
template<typename Func , typename... ArgTs, typename AltRetT = typename Func::ReturnType>
detail::ResultTraits< AltRetT >::ErrorReturnType callB (const ArgTs &... Args)
 Call Func on Channel C. More...
 
Error handlerLoop ()
 Handle incoming RPC calls. More...
 
- Public Member Functions inherited from llvm::orc::rpc::detail::RPCEndpointBase< MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >
 RPCEndpointBase (ChannelT &C, bool LazyAutoNegotiation)
 Construct an RPC instance on a channel. More...
 
Error negotiateFunction (bool Retry=false)
 Negotiate a function id for Func with the other end of the channel. More...
 
Error appendCallAsync (HandlerT Handler, const ArgTs &... Args)
 Append a call Func, does not call send on the channel. More...
 
Error sendAppendedCalls ()
 
Error callAsync (HandlerT Handler, const ArgTs &... Args)
 
Error handleOne ()
 Handle one incoming call. More...
 
void abandonPendingResponses ()
 Abandon all outstanding result handlers. More...
 
void removeHandler ()
 Remove the handler for the given function. More...
 
void clearHandlers ()
 Clear all handlers. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::orc::rpc::detail::RPCEndpointBase< MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >
**static detail::ReadArgs< ArgTs... > readArgs (ArgTs &... Args)
 Helper for handling setter procedures - this method returns a functor that sets the variables referred to by Args... More...
 
- Protected Types inherited from llvm::orc::rpc::detail::RPCEndpointBase< MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >
using WrappedHandlerFn = std::function< Error(ChannelT &, SequenceNumberT)>
 
- Protected Member Functions inherited from llvm::orc::rpc::detail::RPCEndpointBase< MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >
FunctionIdT getInvalidFunctionId () const
 
void addHandlerImpl (HandlerT Handler)
 Add the given handler to the handler map and make it available for autonegotiation and execution. More...
 
void addAsyncHandlerImpl (HandlerT Handler)
 
Error handleResponse (SequenceNumberT SeqNo)
 
FunctionIdT handleNegotiate (const std::string &Name)
 
Expected< FunctionIdT > getRemoteFunctionId (bool NegotiateIfNotInMap, bool NegotiateIfInvalid)
 
WrappedHandlerFn wrapHandler (HandlerT Handler)
 
WrappedHandlerFn wrapAsyncHandler (HandlerT Handler)
 
- Protected Attributes inherited from llvm::orc::rpc::detail::RPCEndpointBase< MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >
ChannelT & C
 
bool LazyAutoNegotiation
 
RPCFunctionIdAllocator< FunctionIdT > FnIdAllocator
 
FunctionIdT ResponseId
 
std::map< std::string, FunctionIdT > LocalFunctionIds
 
std::map< const char *, FunctionIdT > RemoteFunctionIds
 
std::map< FunctionIdT, WrappedHandlerFnHandlers
 
std::mutex ResponsesMutex
 
detail::SequenceNumberManager< SequenceNumberT > SequenceNumberMgr
 
std::map< SequenceNumberT, std::unique_ptr< detail::ResponseHandler< ChannelT > > > PendingResponses
 

Detailed Description

template<typename ChannelT, typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
class llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >

Definition at line 1422 of file RPCUtils.h.

Member Typedef Documentation

◆ NonBlockingCallResult

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
template<typename Func >
using llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::NonBlockingCallResult = typename detail::ResultTraits< typename Func::ReturnType>::ReturnFutureType

Return type for non-blocking call primitives.

Definition at line 1466 of file RPCUtils.h.

Constructor & Destructor Documentation

◆ MultiThreadedRPCEndpoint()

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::MultiThreadedRPCEndpoint ( ChannelT &  C,
bool  LazyAutoNegotiation 
)
inline

Definition at line 1433 of file RPCUtils.h.

Member Function Documentation

◆ addAsyncHandler() [1/2]

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
template<typename Func , typename HandlerT >
void llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::addAsyncHandler ( HandlerT  Handler)
inline

Definition at line 1452 of file RPCUtils.h.

◆ addAsyncHandler() [2/2]

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
template<typename Func , typename ClassT , typename RetT , typename... ArgTs>
void llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::addAsyncHandler ( ClassT &  Object,
RetT(ClassT::*)(ArgTs...)  Method 
)
inline

Add a class-method as a handler.

Definition at line 1458 of file RPCUtils.h.

◆ addHandler() [1/2]

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
template<typename Func , typename HandlerT >
void llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::addHandler ( HandlerT  Handler)
inline

Add a handler for the given RPC function.

This installs the given handler functor for the given RPC Function, and makes the RPC function available for negotiation/calling from the remote.

Definition at line 1440 of file RPCUtils.h.

◆ addHandler() [2/2]

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
template<typename Func , typename ClassT , typename RetT , typename... ArgTs>
void llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::addHandler ( ClassT &  Object,
RetT(ClassT::*)(ArgTs...)  Method 
)
inline

Add a class-method as a handler.

Definition at line 1446 of file RPCUtils.h.

◆ appendCallNB()

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
template<typename Func , typename... ArgTs>
Expected<NonBlockingCallResult<Func> > llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::appendCallNB ( const ArgTs &...  Args)
inline

Call Func on Channel C.

Does not block, does not call send. Returns a pair of a future result and the sequence number assigned to the result.

This utility function is primarily used for single-threaded mode support, where the sequence number can be used to wait for the corresponding result. In multi-threaded mode the appendCallNB method, which does not return the sequence numeber, should be preferred.

Definition at line 1476 of file RPCUtils.h.

References llvm::Error::success().

◆ callB()

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
template<typename Func , typename... ArgTs, typename AltRetT = typename Func::ReturnType>
detail::ResultTraits<AltRetT>::ErrorReturnType llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::callB ( const ArgTs &...  Args)
inline

Call Func on Channel C.

Blocks waiting for a result. Returns an Error for void functions or an Expected<T> for functions returning a T.

This function is for use in threaded code where another thread is handling responses and incoming calls.

Definition at line 1522 of file RPCUtils.h.

◆ callNB()

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
template<typename Func , typename... ArgTs>
Expected<NonBlockingCallResult<Func> > llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::callNB ( const ArgTs &...  Args)
inline

The same as appendCallNBWithSeq, except that it calls C.send() to flush the channel after serializing the call.

Definition at line 1501 of file RPCUtils.h.

References C, and llvm::orc::rpc::detail::ResultTraits< RetT >::consumeAbandoned().

◆ handlerLoop()

template<typename ChannelT , typename FunctionIdT = uint32_t, typename SequenceNumberT = uint32_t>
Error llvm::orc::rpc::MultiThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >::handlerLoop ( )
inline

Handle incoming RPC calls.

Definition at line 1530 of file RPCUtils.h.

References llvm::Error::success().


The documentation for this class was generated from the following file: