Derecho  0.9
Distributed systems toolkit for RDMA
Classes | Namespaces | Macros | Functions
remote_invocable.hpp File Reference
#include <functional>
#include <numeric>
#include <type_traits>
#include "rpc_utils.hpp"
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/utils/logger.hpp>
#include <mutils/FunctionalMap.hpp>
#include <mutils/tuple_extras.hpp>
#include <spdlog/spdlog.h>
Include dependency graph for remote_invocable.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  derecho::rpc::RemoteInvocable< FunctionTag, typename >
 
struct  derecho::rpc::RemoteInvoker< FunctionTag, typename >
 
struct  derecho::rpc::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...
 
struct  derecho::rpc::RemoteInvoker< Tag, std::function< Ret(Args...)> >::send_return
 Return type for the send function. More...
 
struct  derecho::rpc::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...
 
struct  derecho::rpc::wrapped< Tag, NotAFunction >
 This matches uses of wrapped<> where the second argument is not a function, and does nothing. More...
 
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. More...
 
struct  derecho::rpc::partial_wrapped< Tag, Ret, Class, Arguments >
 Template that pairs a FunctionTag with a pointer-to-member-function. More...
 
struct  derecho::rpc::const_partial_wrapped< Tag, Ret, Class, Arguments >
 Exactly the same as the partial_wrapped template, but for pointer-to-member-functions that are const. More...
 
struct  derecho::rpc::RemoteInvocablePairs<... >
 
struct  derecho::rpc::RemoteInvocablePairs< wrapped< id, FunType > >
 Base case for RemoteInvocablePairs, where the template parameter pack contains only a single wrapped<id, FunType> More...
 
struct  derecho::rpc::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  derecho::rpc::RemoteInvokers<... >
 Technically, RemoteInvokers is a specialization of this template, but it's the only specialization, so this template does nothing. More...
 
struct  derecho::rpc::RemoteInvokers< wrapped< Tag, FunType > >
 Base case for RemoteInvokers, where the template parameter pack contains only a single wrapped<id, FunType> More...
 
struct  derecho::rpc::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  derecho::rpc::RemoteInvocableClass< IdentifyingClass, WrappedFuns >
 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  derecho::rpc::RemoteInvocableClass< IdentifyingClass >
 Specialization of RemoteInvocableClass for classes that have no RPC methods. More...
 
class  derecho::rpc::RemoteInvokerForClass< IdentifyingClass, WrappedFuns >
 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  derecho::rpc::RemoteInvokerForClass< IdentifyingClass >
 Specialization of RemoteInvokerForClass for classes that have no RPC methods. More...
 

Namespaces

 derecho
 
 derecho::rpc
 

Macros

#define MAX_CONCURRENT_RPCS_PER_INVOKER   (4096)
 

Functions

bool derecho::rpc::in_rpc_handler ()
 defined in rpc_manager.h More...
 
template<typename NewClass , FunctionTag Tag, typename Ret , typename... Args>
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. More...
 
template<typename NewClass , FunctionTag Tag, typename Ret , typename... Args>
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. More...
 
template<FunctionTag Tag, typename NewClass , typename Ret , typename... Args>
partial_wrapped< Tag, Ret, NewClass, Args... > derecho::rpc::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... > derecho::rpc::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 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). More...
 
template<class IdentifyingClass , typename... WrappedFuns>
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). More...
 

Class Documentation

◆ derecho::rpc::RemoteInvocable

struct derecho::rpc::RemoteInvocable

template<FunctionTag, typename>
struct derecho::rpc::RemoteInvocable< FunctionTag, typename >

Definition at line 31 of file remote_invocable.hpp.

◆ derecho::rpc::RemoteInvoker

struct derecho::rpc::RemoteInvoker

template<FunctionTag, typename>
struct derecho::rpc::RemoteInvoker< FunctionTag, typename >

Definition at line 34 of file remote_invocable.hpp.

◆ derecho::rpc::RemoteInvoker< Tag, std::function< Ret(Args...)> >::send_return

struct derecho::rpc::RemoteInvoker< Tag, std::function< Ret(Args...)> >::send_return

template<FunctionTag Tag, typename Ret, typename... Args>
struct derecho::rpc::RemoteInvoker< Tag, std::function< Ret(Args...)> >::send_return

Return type for the send function.

Contains the RPC-invoking message (in a buffer of size "size"), a set of futures for the results, and a set of promises for the results.

Definition at line 100 of file remote_invocable.hpp.

Class Members
char * buf
PendingResults< Ret > & pending
QueryResults< Ret > results
size_t size

◆ derecho::rpc::wrapped

struct derecho::rpc::wrapped

template<FunctionTag Tag, typename NotAFunction>
struct derecho::rpc::wrapped< Tag, NotAFunction >

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.

◆ derecho::rpc::wrapped< Tag, std::function< Ret(Arguments...)> >

struct derecho::rpc::wrapped< Tag, std::function< Ret(Arguments...)> >

template<FunctionTag Tag, typename Ret, typename... Arguments>
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

◆ derecho::rpc::RemoteInvocablePairs

struct derecho::rpc::RemoteInvocablePairs

template<typename...>
struct derecho::rpc::RemoteInvocablePairs<... >

Definition at line 481 of file remote_invocable.hpp.

◆ derecho::rpc::RemoteInvokers

struct derecho::rpc::RemoteInvokers

template<typename...>
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.

Macro Definition Documentation

◆ MAX_CONCURRENT_RPCS_PER_INVOKER

#define MAX_CONCURRENT_RPCS_PER_INVOKER   (4096)

Definition at line 65 of file remote_invocable.hpp.