|
LLVM
4.0.0
|
Contains primitive utilities for defining, calling and handling calls to remote procedures. More...
#include <RPCUtils.h>
Classes | |
| class | CanDeserializeCheck |
| class | CanSerializeCheck |
| class | OrcRPCInvalid |
| class | OrcRPCNegotiate |
| class | OrcRPCResponse |
Public Member Functions | |
| RPCEndpointBase (ChannelT &C, bool LazyAutoNegotiation) | |
| Construct an RPC instance on a channel. More... | |
| template<typename Func , typename HandlerT , typename... ArgTs> | |
| Error | appendCallAsync (HandlerT Handler, const ArgTs &...Args) |
| Append a call Func, does not call send on the channel. More... | |
| Error | sendAppendedCalls () |
| template<typename Func , typename HandlerT , typename... ArgTs> | |
| Error | callAsync (HandlerT Handler, const ArgTs &...Args) |
| Error | handleOne () |
| Handle one incoming call. More... | |
| void | abandonPendingResponses () |
| Abandon all outstanding result handlers. More... | |
Static Public Member Functions | |
| template<typename... ArgTs> | |
| **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 | |
| using | LaunchPolicy = std::function< Error(std::function< Error()>)> |
| using | WrappedHandlerFn = std::function< Error(ChannelT &, SequenceNumberT)> |
Protected Member Functions | |
| FunctionIdT | getInvalidFunctionId () const |
| template<typename Func , typename HandlerT > | |
| void | addHandlerImpl (HandlerT Handler, LaunchPolicy Launch) |
| Add the given handler to the handler map and make it available for autonegotiation and execution. More... | |
| Error | handleResponse (SequenceNumberT SeqNo) |
| FunctionIdT | handleNegotiate (const std::string &Name) |
| template<typename Func > | |
| Expected< FunctionIdT > | getRemoteFunctionId () |
| template<typename Func , typename HandlerT > | |
| WrappedHandlerFn | wrapHandler (HandlerT Handler, LaunchPolicy Launch) |
Protected Attributes | |
| ChannelT & | C |
| bool | LazyAutoNegotiation |
| RPCFunctionIdAllocator < FunctionIdT > | FnIdAllocator |
| FunctionIdT | ResponseId |
| std::map< std::string, FunctionIdT > | LocalFunctionIds |
| std::map< const char *, FunctionIdT > | RemoteFunctionIds |
| std::map< FunctionIdT, WrappedHandlerFn > | Handlers |
| std::mutex | ResponsesMutex |
| detail::SequenceNumberManager < SequenceNumberT > | SequenceNumberMgr |
| std::map< SequenceNumberT, std::unique_ptr < detail::ResponseHandler < ChannelT > > > | PendingResponses |
Contains primitive utilities for defining, calling and handling calls to remote procedures.
ChannelT is a bidirectional stream conforming to the RPCChannel interface (see RPCChannel.h), FunctionIdT is a procedure identifier type that must be serializable on ChannelT, and SequenceNumberT is an integral type that will be used to number in-flight function calls.
These utilities support the construction of very primitive RPC utilities. Their intent is to ensure correct serialization and deserialization of procedure arguments, and to keep the client and server's view of the API in sync.
Definition at line 705 of file RPCUtils.h.
|
protected |
Definition at line 893 of file RPCUtils.h.
|
protected |
Definition at line 991 of file RPCUtils.h.
|
inline |
Construct an RPC instance on a channel.
Definition at line 750 of file RPCUtils.h.
|
inline |
Abandon all outstanding result handlers.
This will call all currently registered result handlers to receive an "abandoned" error as their argument. This is used internally by the RPC in error situations, but can also be called directly by clients who are disconnecting from the remote and don't or can't expect responses to their outstanding calls. (Especially for outstanding blocking calls, calling this function may be necessary to avoid dead threads).
Definition at line 880 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::appendCallAsync(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::handleResponse().
|
inlineprotected |
Add the given handler to the handler map and make it available for autonegotiation and execution.
Definition at line 902 of file RPCUtils.h.
|
inline |
Append a call Func, does not call send on the channel.
The first argument specifies a user-defined handler to be run when the function returns. The handler should take an Expected<Func::ReturnType>, or an Error (if Func::ReturnType is void). The handler will be called with an error if the return value is abandoned due to a channel error.
Definition at line 771 of file RPCUtils.h.
|
inline |
Definition at line 832 of file RPCUtils.h.
|
inlineprotected |
Definition at line 895 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::getRemoteFunctionId(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::handleNegotiate().
|
inlineprotected |
Definition at line 956 of file RPCUtils.h.
|
inlineprotected |
|
inline |
Handle one incoming call.
Definition at line 839 of file RPCUtils.h.
|
inlineprotected |
Definition at line 915 of file RPCUtils.h.
|
inlinestatic |
Helper for handling setter procedures - this method returns a functor that sets the variables referred to by Args...
to values deserialized from the channel. E.g.
typedef Function<0, bool, int> Func1;
... bool B; int I; if (auto Err = expect<Func1>(Channel, readArgs(B, I))) /* Handle Args
Definition at line 868 of file RPCUtils.h.
|
inline |
Definition at line 829 of file RPCUtils.h.
|
inlineprotected |
Definition at line 996 of file RPCUtils.h.
|
protected |
Definition at line 1035 of file RPCUtils.h.
|
protected |
Definition at line 1039 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::addHandlerImpl(), llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::getInvalidFunctionId(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::RPCEndpointBase().
|
protected |
Definition at line 1045 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::addHandlerImpl(), llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::handleOne(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::RPCEndpointBase().
|
protected |
|
protected |
Definition at line 1042 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::addHandlerImpl(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::handleNegotiate().
|
protected |
Definition at line 1050 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::abandonPendingResponses(), llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::appendCallAsync(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::handleResponse().
|
protected |
Definition at line 1043 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::getRemoteFunctionId(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::RPCEndpointBase().
|
protected |
Definition at line 1041 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::handleOne(), llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::RPCEndpointBase(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::wrapHandler().
|
protected |
Definition at line 1047 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::abandonPendingResponses(), llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::appendCallAsync(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::handleResponse().
|
protected |
Definition at line 1048 of file RPCUtils.h.
Referenced by llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::abandonPendingResponses(), llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::appendCallAsync(), and llvm::orc::rpc::detail::RPCEndpointBase< SingleThreadedRPCEndpoint< ChannelT, FunctionIdT, SequenceNumberT >, ChannelT, FunctionIdT, SequenceNumberT >::handleResponse().
1.8.6