Derecho  0.9
Distributed systems toolkit for RDMA
Public Types | Public Member Functions | Public Attributes | List of all members
derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> > Struct Template Reference

Provides functions to implement handling RPC calls to a single function, identified by its compile-time "tag" or opcode. More...

#include <remote_invocable.hpp>

Collaboration diagram for derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >:
Collaboration graph
[legend]

Public Types

using remote_function_type = std::function< Ret(Args...)>
 

Public Member Functions

RemoteInvocableget_handler (std::integral_constant< FunctionTag, Tag > const *const, const Args &...)
 
recv_ret receive_call (std::false_type const *const, mutils::DeserializationManager *dsm, const node_id_t &caller, const char *_recv_buf, const std::function< char *(int)> &out_alloc)
 Specialization of receive_call for non-void functions. More...
 
recv_ret receive_call (std::true_type const *const, mutils::DeserializationManager *dsm, const node_id_t &, const char *_recv_buf, const std::function< char *(int)> &)
 Specialization of receive_call for void functions, which do not need to send a response. More...
 
recv_ret receive_call (mutils::RemoteDeserialization_v *rdv, const node_id_t &who, const char *recv_buf, const std::function< char *(int)> &out_alloc)
 Entry point for handling an RPC function call to this RemoteInvocable function. More...
 
 RemoteInvocable (uint32_t class_id, uint32_t instance_id, std::map< Opcode, receive_fun_t > &receivers, std::function< Ret(Args...)> f)
 Constructs a RemoteInvocable that provides RPC call handling for a specific function, and registers the RPC-handling functions in the given "receivers" map. More...
 

Public Attributes

const remote_function_type remote_invocable_function
 
const Opcode invoke_opcode
 
const Opcode reply_opcode
 

Detailed Description

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

Many versions of this class will be extended by a single RemoteInvocableClass; each specific instance of this class provides a mechanism for handling RPC requests for one particular function.

Template Parameters
tagThe compile-time value associated with this function
RetThe function's return type
ArgsThe function's argument types

Definition at line 267 of file remote_invocable.hpp.

Member Typedef Documentation

◆ remote_function_type

template<FunctionTag Tag, typename Ret , typename... Args>
using derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::remote_function_type = std::function<Ret(Args...)>

Definition at line 268 of file remote_invocable.hpp.

Constructor & Destructor Documentation

◆ RemoteInvocable()

template<FunctionTag Tag, typename Ret , typename... Args>
derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::RemoteInvocable ( uint32_t  class_id,
uint32_t  instance_id,
std::map< Opcode, receive_fun_t > &  receivers,
std::function< Ret(Args...)>  f 
)
inline

Constructs a RemoteInvocable that provides RPC call handling for a specific function, and registers the RPC-handling functions in the given "receivers" map.

Parameters
receiversA map from RPC message opcodes to handler functions, which this RemoteInvocable should add its functions to.
fThe actual function that should be called when an RPC call arrives.

Definition at line 356 of file remote_invocable.hpp.

Member Function Documentation

◆ get_handler()

template<FunctionTag Tag, typename Ret , typename... Args>
RemoteInvocable& derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::get_handler ( std::integral_constant< FunctionTag, Tag > const *  const,
const Args &  ... 
)
inline

Definition at line 276 of file remote_invocable.hpp.

◆ receive_call() [1/3]

template<FunctionTag Tag, typename Ret , typename... Args>
recv_ret derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::receive_call ( std::false_type const *  const,
mutils::DeserializationManager dsm,
const node_id_t caller,
const char *  _recv_buf,
const std::function< char *(int)> &  out_alloc 
)
inline

Specialization of receive_call for non-void functions.

After calling the function locally, it constructs a message containing the return value to send as a response, and puts it in a buffer allocated by out_alloc. If the function throws an exception, it catches the exception and puts that in the response message instead.

Definition at line 289 of file remote_invocable.hpp.

◆ receive_call() [2/3]

template<FunctionTag Tag, typename Ret , typename... Args>
recv_ret derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::receive_call ( std::true_type const *  const,
mutils::DeserializationManager dsm,
const node_id_t ,
const char *  _recv_buf,
const std::function< char *(int)> &   
)
inline

Specialization of receive_call for void functions, which do not need to send a response.

Simply calls the function and returns a trivial result.

Definition at line 317 of file remote_invocable.hpp.

◆ receive_call() [3/3]

template<FunctionTag Tag, typename Ret , typename... Args>
recv_ret derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::receive_call ( mutils::RemoteDeserialization_v rdv,
const node_id_t who,
const char *  recv_buf,
const std::function< char *(int)> &  out_alloc 
)
inline

Entry point for handling an RPC function call to this RemoteInvocable function.

Called when a message is received that contains a request to call this function.

Parameters
dsm
whoThe node that sent the message
recv_bufThe buffer containing the received message
out_allocA function that can allocate a buffer for the response message
Returns

Definition at line 337 of file remote_invocable.hpp.

Member Data Documentation

◆ invoke_opcode

template<FunctionTag Tag, typename Ret , typename... Args>
const Opcode derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::invoke_opcode

Definition at line 270 of file remote_invocable.hpp.

◆ remote_invocable_function

template<FunctionTag Tag, typename Ret , typename... Args>
const remote_function_type derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::remote_invocable_function

Definition at line 269 of file remote_invocable.hpp.

◆ reply_opcode

template<FunctionTag Tag, typename Ret , typename... Args>
const Opcode derecho::rpc::RemoteInvocable< Tag, std::function< Ret(Args...)> >::reply_opcode

Definition at line 271 of file remote_invocable.hpp.


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