LLVM
8.0.1
|
Contains primitive utilities for defining, calling and handling calls to remote procedures. More...
#include "llvm/ExecutionEngine/Orc/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 > | |
Error | negotiateFunction (bool Retry=false) |
Negotiate a function id for Func with the other end of the 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... | |
template<typename Func > | |
void | removeHandler () |
Remove the handler for the given function. More... | |
void | clearHandlers () |
Clear all 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 | WrappedHandlerFn = std::function< Error(ChannelT &, SequenceNumberT)> |
Protected Member Functions | |
FunctionIdT | getInvalidFunctionId () const |
template<typename Func , typename HandlerT > | |
void | addHandlerImpl (HandlerT Handler) |
Add the given handler to the handler map and make it available for autonegotiation and execution. More... | |
template<typename Func , typename HandlerT > | |
void | addAsyncHandlerImpl (HandlerT Handler) |
Error | handleResponse (SequenceNumberT SeqNo) |
FunctionIdT | handleNegotiate (const std::string &Name) |
template<typename Func > | |
Expected< FunctionIdT > | getRemoteFunctionId (bool NegotiateIfNotInMap, bool NegotiateIfInvalid) |
template<typename Func , typename HandlerT > | |
WrappedHandlerFn | wrapHandler (HandlerT Handler) |
template<typename Func , typename HandlerT > | |
WrappedHandlerFn | wrapAsyncHandler (HandlerT Handler) |
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 940 of file RPCUtils.h.
|
protected |
Definition at line 1260 of file RPCUtils.h.
|
inline |
Construct an RPC instance on a channel.
Definition at line 985 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 1121 of file RPCUtils.h.
|
inlineprotected |
Definition at line 1171 of file RPCUtils.h.
|
inlineprotected |
Add the given handler to the handler map and make it available for autonegotiation and execution.
Definition at line 1158 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 1011 of file RPCUtils.h.
|
inline |
Definition at line 1070 of file RPCUtils.h.
|
inline |
Clear all handlers.
Definition at line 1145 of file RPCUtils.h.
|
inlineprotected |
Definition at line 1151 of file RPCUtils.h.
|
inlineprotected |
Definition at line 1227 of file RPCUtils.h.
|
inlineprotected |
Definition at line 1218 of file RPCUtils.h.
|
inline |
Handle one incoming call.
Definition at line 1077 of file RPCUtils.h.
|
inlineprotected |
Definition at line 1185 of file RPCUtils.h.
|
inline |
Negotiate a function id for Func with the other end of the channel.
Definition at line 1001 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 1109 of file RPCUtils.h.
|
inline |
Remove the handler for the given function.
A handler must currently be registered for this function.
Definition at line 1134 of file RPCUtils.h.
|
inline |
Definition at line 1067 of file RPCUtils.h.
|
inlineprotected |
Definition at line 1298 of file RPCUtils.h.
|
inlineprotected |
Definition at line 1265 of file RPCUtils.h.
|
protected |
Definition at line 1334 of file RPCUtils.h.
|
protected |
Definition at line 1338 of file RPCUtils.h.
|
protected |
Definition at line 1344 of file RPCUtils.h.
|
protected |
Definition at line 1336 of file RPCUtils.h.
|
protected |
Definition at line 1341 of file RPCUtils.h.
|
protected |
Definition at line 1349 of file RPCUtils.h.
|
protected |
Definition at line 1342 of file RPCUtils.h.
|
protected |
Definition at line 1340 of file RPCUtils.h.
|
protected |
Definition at line 1346 of file RPCUtils.h.
|
protected |
Definition at line 1347 of file RPCUtils.h.