Namespaces | |
remote_invocation_utilities | |
Utility functions for manipulating the headers of RPC messages. | |
Classes | |
struct | const_partial_wrapped |
Exactly the same as the partial_wrapped template, but for pointer-to-member-functions that are const. More... | |
struct | node_removed_from_group_exception |
Indicates that an RPC call to a node failed because the node was removed from the Replicated Object's subgroup (and possibly from the enclosing Group entirely) after the RPC message was sent but before a reply was received. More... | |
struct | Opcode |
An RPC function call can be uniquely identified by the tuple (class, subgroup ID, function ID, is-reply), which is what this struct encapsulates. More... | |
struct | partial_wrapped |
Template that pairs a FunctionTag with a pointer-to-member-function. More... | |
class | PendingBase |
Abstract base type for PendingResults. More... | |
class | PendingResults |
Data structure that holds a set of promises for a single RPC function call; the promises transmit one response (either a value or an exception) for each node that was called. More... | |
class | PendingResults< void > |
Specialization of PendingResults for void functions, which do not generate replies. More... | |
class | QueryResults |
Data structure that (indirectly) holds a set of futures for a single RPC function call; there is one future for each node contacted to make the call, and it will eventually contain that node's reply. More... | |
class | QueryResults< void > |
Specialization of QueryResults for void functions, which do not generate replies. More... | |
struct | recv_ret |
Return type of all the RemoteInvocable::receive_* methods. More... | |
struct | remote_exception_occurred |
Indicates that an RPC call failed because executing the RPC function on the remote node resulted in an exception. More... | |
struct | RemoteInvocable |
struct | RemoteInvocable< Tag, std::function< Ret(Args...)> > |
Provides functions to implement handling RPC calls to a single function, identified by its compile-time "tag" or opcode. More... | |
class | RemoteInvocableClass |
Transforms a class into a "replicated object" with methods that can be invoked by RPC, given a place to store RPC message handlers (which should be the "receivers map" of RPCManager). More... | |
class | RemoteInvocableClass< IdentifyingClass > |
Specialization of RemoteInvocableClass for classes that have no RPC methods. More... | |
struct | RemoteInvocablePairs |
struct | RemoteInvocablePairs< wrapped< id, FunType > > |
Base case for RemoteInvocablePairs, where the template parameter pack contains only a single wrapped<id, FunType> More... | |
struct | RemoteInvocablePairs< wrapped< id, FunType >, rest... > |
This struct exists purely to inherit from a series of RemoteInvoker and RemoteInvocables; it inherits one pair of RemoteInvoker/RemoteInvocable for each wrapped<id, FunType> type in its template parameter pack. More... | |
struct | RemoteInvoker |
struct | RemoteInvoker< Tag, std::function< Ret(Args...)> > |
Provides functions to implement RPC sends for function calls to a single function, identified by its compile-time "tag" or ID. More... | |
class | RemoteInvokerForClass |
Transforms a class into an RPC client for the methods of that class, given a place to store RPC message handlers (which should be the "receivers map" of RPCManager). More... | |
class | RemoteInvokerForClass< IdentifyingClass > |
Specialization of RemoteInvokerForClass for classes that have no RPC methods. More... | |
struct | RemoteInvokers |
Technically, RemoteInvokers is a specialization of this template, but it's the only specialization, so this template does nothing. More... | |
struct | RemoteInvokers< wrapped< Tag, FunType > > |
Base case for RemoteInvokers, where the template parameter pack contains only a single wrapped<id, FunType> More... | |
struct | RemoteInvokers< wrapped< Tag, FunType >, RestWrapped... > |
This struct exists purely to inherit from a list of RemoteInvokers, one for each wrapped<> type in its template parameter pack. More... | |
class | RPCManager |
struct | sender_removed_from_group_exception |
Indicates that an RPC call from this node was aborted because this node was removed from its subgroup/shard (and reassigned to another one) during the view change. More... | |
struct | String |
This "compile-time String" puts a short sequence of characters into a type's template parameter, allowing it to be accessed at compile-time in a constexpr hash function. More... | |
struct | wrapped |
This matches uses of wrapped<> where the second argument is not a function, and does nothing. More... | |
struct | wrapped< Tag, std::function< Ret(Arguments...)> > |
Template that pairs a FunctionTag with a function pointer, thus "naming" the function with a tag (ID) that is a compile-time value. More... | |
Typedefs | |
using | PendingBase_ref = std::reference_wrapper< PendingBase > |
template<typename T > | |
using | RemoteInvocableOf = std::decay_t< decltype(*std::declval< RPCManager >() .make_remote_invocable_class(std::declval< std::unique_ptr< T > * >(), std::declval< uint32_t >(), std::declval< uint32_t >(), T::register_functions()))> |
template<typename T > | |
using | RemoteInvokerFor = std::decay_t< decltype(*std::declval< RPCManager >() .make_remote_invoker< T >(std::declval< uint32_t >(), std::declval< uint32_t >(), T::register_functions()))> |
using | FunctionTag = unsigned long long |
using | node_list_t = std::vector< node_id_t > |
using | receive_fun_t = std::function< recv_ret(mutils::RemoteDeserialization_v *rdv, const node_id_t &, const char *recv_buf, const std::function< char *(int)> &out_alloc)> |
Type signature for all the RemoteInvocable::receive_* methods. More... | |
template<typename T > | |
using | reply_map = std::map< node_id_t, std::future< T > > |
The type of map contained in a QueryResults::ReplyMap. More... | |
Functions | |
bool | in_rpc_handler () |
defined in rpc_manager.h More... | |
template<typename NewClass , FunctionTag Tag, typename Ret , typename... Args> | |
wrapped< Tag, std::function< Ret(Args...)> > | bind_to_instance (std::unique_ptr< NewClass > *_this, const partial_wrapped< Tag, Ret, NewClass, Args... > &partial) |
Converts a partial_wrapped<> containing a pointer-to-member-function to a wrapped<> containing the same function as a std::function. More... | |
template<typename NewClass , FunctionTag Tag, typename Ret , typename... Args> | |
wrapped< Tag, std::function< Ret(Args...)> > | bind_to_instance (std::unique_ptr< NewClass > *_this, const const_partial_wrapped< Tag, Ret, NewClass, Args... > &partial) |
Exactly the same as the bind_to_instance function above, but for pointer-to-member-functions that are const. More... | |
template<FunctionTag Tag, typename NewClass , typename Ret , typename... Args> | |
partial_wrapped< Tag, Ret, NewClass, Args... > | tag (Ret(NewClass::*fun)(Args...)) |
User-facing entry point for the series of functions that binds a FunctionTag to a class's member function. More... | |
template<FunctionTag Tag, typename NewClass , typename Ret , typename... Args> | |
const_partial_wrapped< Tag, Ret, NewClass, Args... > | tag (Ret(NewClass::*fun)(Args...) const) |
Exactly the same as the above tag() function, but for const member functions. More... | |
template<class IdentifyingClass , typename... WrappedFuns> | |
auto | build_remote_invocable_class (const node_id_t nid, const uint32_t type_id, const uint32_t instance_id, std::map< Opcode, receive_fun_t > &rvrs, const WrappedFuns &... fs) |
Constructs a RemoteInvocableClass instance that proxies for an instance of the class in the template parameter (IdentifyingClass). More... | |
template<class IdentifyingClass , typename... WrappedFuns> | |
auto | build_remote_invoker_for_class (const node_id_t nid, const uint32_t type_id, const uint32_t instance_id, std::map< Opcode, receive_fun_t > &rvrs) |
Constructs a RemoteInvokerForClass that can act as a client for the class in the template parameter (IdentifyingClass). More... | |
bool | operator< (const Opcode &lhs, const Opcode &rhs) |
bool | operator== (const Opcode &lhs, const Opcode &rhs) |
Variables | |
thread_local bool | _in_rpc_handler = false |
struct derecho::rpc::Opcode |
An RPC function call can be uniquely identified by the tuple (class, subgroup ID, function ID, is-reply), which is what this struct encapsulates.
Its comparsion operators simply inherit the ones from std::tuple.
Definition at line 62 of file rpc_utils.hpp.
Class Members | ||
---|---|---|
subgroup_type_id_t | class_id | |
FunctionTag | function_id | |
bool | is_reply | |
subgroup_id_t | subgroup_id |
struct derecho::rpc::recv_ret |
Return type of all the RemoteInvocable::receive_* methods.
If the method is receive_call, this struct contains the message to send in reply, along with its size in bytes, and a pointer to the exception generated by the function call if one was thrown.
Definition at line 122 of file rpc_utils.hpp.
Class Members | ||
---|---|---|
Opcode | opcode | |
char * | payload | |
exception_ptr | possible_exception | |
size_t | size |
struct derecho::rpc::RemoteInvocable |
Definition at line 31 of file remote_invocable.hpp.
struct derecho::rpc::RemoteInvocablePairs |
Definition at line 481 of file remote_invocable.hpp.
struct derecho::rpc::RemoteInvoker |
Definition at line 34 of file remote_invocable.hpp.
struct derecho::rpc::RemoteInvokers |
Technically, RemoteInvokers is a specialization of this template, but it's the only specialization, so this template does nothing.
Definition at line 537 of file remote_invocable.hpp.
struct derecho::rpc::wrapped |
This matches uses of wrapped<> where the second argument is not a function, and does nothing.
Definition at line 371 of file remote_invocable.hpp.
struct derecho::rpc::wrapped< Tag, std::function< Ret(Arguments...)> > |
Template that pairs a FunctionTag with a function pointer, thus "naming" the function with a tag (ID) that is a compile-time value.
In practice, it has two template parameters, where the second one matches std::function<Ret(Args...)>, but the two types in the std::function must each be written as a separate template parameter.
Definition at line 381 of file remote_invocable.hpp.
Class Members | ||
---|---|---|
fun_t |
Class Members | ||
---|---|---|
fun_t | fun |
using derecho::rpc::FunctionTag = typedef unsigned long long |
Definition at line 54 of file rpc_utils.hpp.
using derecho::rpc::node_list_t = typedef std::vector<node_id_t> |
Definition at line 77 of file rpc_utils.hpp.
using derecho::rpc::PendingBase_ref = typedef std::reference_wrapper<PendingBase> |
Definition at line 40 of file rpc_manager.hpp.
using derecho::rpc::receive_fun_t = typedef std::function<recv_ret( mutils::RemoteDeserialization_v* rdv, const node_id_t&, const char* recv_buf, const std::function<char*(int)>& out_alloc)> |
Type signature for all the RemoteInvocable::receive_* methods.
This alias is helpful for declaring a map of "RPC receive handlers" that are called when some RPC message is received.
Definition at line 137 of file rpc_utils.hpp.
using derecho::rpc::RemoteInvocableOf = typedef std::decay_t<decltype(*std::declval<RPCManager>() .make_remote_invocable_class(std::declval<std::unique_ptr<T>*>(), std::declval<uint32_t>(), std::declval<uint32_t>(), T::register_functions()))> |
Definition at line 298 of file rpc_manager.hpp.
using derecho::rpc::RemoteInvokerFor = typedef std::decay_t<decltype(*std::declval<RPCManager>() .make_remote_invoker<T>(std::declval<uint32_t>(), std::declval<uint32_t>(), T::register_functions()))> |
Definition at line 304 of file rpc_manager.hpp.
using derecho::rpc::reply_map = typedef std::map<node_id_t, std::future<T> > |
The type of map contained in a QueryResults::ReplyMap.
The template parameter should be the return type of the query.
Definition at line 144 of file rpc_utils.hpp.
wrapped<Tag, std::function<Ret(Args...)> > derecho::rpc::bind_to_instance | ( | std::unique_ptr< NewClass > * | _this, |
const partial_wrapped< Tag, Ret, NewClass, Args... > & | partial | ||
) |
Converts a partial_wrapped<> containing a pointer-to-member-function to a wrapped<> containing the same function as a std::function.
It does this by constructing a lambda that captures an instance of the function's class and invokes the member function using that instance.
_this | A pointer-to-pointer to an instance of NewClass, the class that contains the member function |
partial | The partial_wrapped to convert |
Definition at line 420 of file remote_invocable.hpp.
wrapped<Tag, std::function<Ret(Args...)> > derecho::rpc::bind_to_instance | ( | std::unique_ptr< NewClass > * | _this, |
const const_partial_wrapped< Tag, Ret, NewClass, Args... > & | partial | ||
) |
Exactly the same as the bind_to_instance function above, but for pointer-to-member-functions that are const.
Definition at line 436 of file remote_invocable.hpp.
auto derecho::rpc::build_remote_invocable_class | ( | const node_id_t | nid, |
const uint32_t | type_id, | ||
const uint32_t | instance_id, | ||
std::map< Opcode, receive_fun_t > & | rvrs, | ||
const WrappedFuns &... | fs | ||
) |
Constructs a RemoteInvocableClass instance that proxies for an instance of the class in the template parameter (IdentifyingClass).
nid | The Node ID of the node running this code |
type_id | A number uniquely identifying the type of IdentifyingClass; in practice, the index of IdentifyingClass within the template parameters of the Group that contains this replicated object. |
instance_id | A number uniquely identifying this instance of IdentifyingClass; in practice, the ID of the subgroup that will be replicating this object. |
rvrs | A map from RPC opcodes to RPC message handler functions, into which new handlers will be added for this RemoteInvocableClass |
fs | A list of "wrapped" function pointers to members of the wrapped class, each associated with a name, which should become RPC functions |
Definition at line 736 of file remote_invocable.hpp.
auto derecho::rpc::build_remote_invoker_for_class | ( | const node_id_t | nid, |
const uint32_t | type_id, | ||
const uint32_t | instance_id, | ||
std::map< Opcode, receive_fun_t > & | rvrs | ||
) |
Constructs a RemoteInvokerForClass that can act as a client for the class in the template parameter (IdentifyingClass).
nid | The Node ID of the node running this code |
type_id | A number uniquely identifying the type of IdentifyingClass; in practice, the index of IdentifyingClass within the template parameters of the Group that contains that replicated object. |
instance_id | A number identifying the servers that should be contacted when calling RPC methods on this class (since more than one instance of the template-parameter class could be running as a RemoteInvocableClass); in practice this is the subgroup ID of the subgroup to contact. |
rvrs | A map from RPC opcodes to RPC message handler functions, into which new handlers will be added for this RemoteInvokerForClass |
Definition at line 828 of file remote_invocable.hpp.
bool derecho::rpc::in_rpc_handler | ( | ) |
defined in rpc_manager.h
Definition at line 370 of file rpc_manager.cpp.
Definition at line 68 of file rpc_utils.hpp.
Definition at line 72 of file rpc_utils.hpp.
partial_wrapped<Tag, Ret, NewClass, Args...> derecho::rpc::tag | ( | Ret(NewClass::*)(Args...) | fun | ) |
User-facing entry point for the series of functions that binds a FunctionTag to a class's member function.
A user's "replicated object" class should use this function in its register_functions() method in order to supply the parameters to setup_rpc_class.
fun | A pointer-to-member-function from the class in the template parameters |
Tag | The compile-time constant that should be used to "name" this member function |
NewClass | The class that the function is a member of |
Ret | The return type of the function |
Args | The argument type of the function |
Definition at line 460 of file remote_invocable.hpp.
const_partial_wrapped<Tag, Ret, NewClass, Args...> derecho::rpc::tag | ( | Ret(NewClass::*)(Args...) const | fun | ) |
Exactly the same as the above tag() function, but for const member functions.
Definition at line 469 of file remote_invocable.hpp.
thread_local bool derecho::rpc::_in_rpc_handler = false |
Definition at line 16 of file rpc_manager.cpp.