Derecho  0.9
Distributed systems toolkit for RDMA
Public Member Functions | Private Attributes | List of all members
derecho::rpc::PendingResults< Ret > Class Template Reference

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

#include <rpc_utils.hpp>

Inheritance diagram for derecho::rpc::PendingResults< Ret >:
Inheritance graph
[legend]
Collaboration diagram for derecho::rpc::PendingResults< Ret >:
Collaboration graph
[legend]

Public Member Functions

 PendingResults ()
 
virtual ~PendingResults ()
 
QueryResults< Ret > get_future ()
 Constructs and returns a QueryResults representing the "future" end of the response promises in this PendingResults. More...
 
void fulfill_map (const node_list_t &who)
 Fill pending_map and reply_promises with one promise/future pair for each node that was contacted in this RPC call. More...
 
void set_exception_for_caller_removed ()
 Sets exceptions to indicate to the sender of this RPC call that it has been removed from its subgroup/shard, and can no longer expect responses. More...
 
void set_exception_for_removed_node (const node_id_t &removed_nid)
 
void set_value (const node_id_t &nid, const Ret &v)
 Fulfills a promise for a single node's reply by setting the value that the node returned for the RPC call. More...
 
void set_exception (const node_id_t &nid, const std::exception_ptr e)
 Fulfills a promise for a single node's reply by setting an exception that was thrown by the RPC function call. More...
 
bool all_responded () const
 
void reset ()
 reset this object. More...
 
- Public Member Functions inherited from derecho::rpc::PendingBase
virtual ~PendingBase ()
 

Private Attributes

std::promise< std::unique_ptr< reply_map< Ret > > > promise_for_pending_map
 A promise for a map containing one future for each reply to the RPC function call. More...
 
std::promise< std::map< node_id_t, std::promise< Ret > > > promise_for_reply_promises
 
std::future< std::map< node_id_t, std::promise< Ret > > > reply_promises_are_ready
 A future for a map containing one promise for each reply to the RPC function call. More...
 
std::mutex reply_promises_are_ready_mutex
 
std::map< node_id_t, std::promise< Ret > > reply_promises
 
bool map_fulfilled = false
 
std::set< node_id_tdest_nodes
 
std::set< node_id_tresponded_nodes
 

Detailed Description

template<typename Ret>
class derecho::rpc::PendingResults< Ret >

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.

The future ends of these promises are stored in a corresponding QueryResults object.

Template Parameters
RetThe return type of the RPC function, which is the type of a response's value.

Definition at line 353 of file rpc_utils.hpp.

Constructor & Destructor Documentation

◆ PendingResults()

template<typename Ret>
derecho::rpc::PendingResults< Ret >::PendingResults ( )
inline

Definition at line 372 of file rpc_utils.hpp.

◆ ~PendingResults()

template<typename Ret>
virtual derecho::rpc::PendingResults< Ret >::~PendingResults ( )
inlinevirtual

Definition at line 374 of file rpc_utils.hpp.

Member Function Documentation

◆ all_responded()

template<typename Ret>
bool derecho::rpc::PendingResults< Ret >::all_responded ( ) const
inlinevirtual
Returns
True if all destination nodes for this RPC function call have responded, either by sending a reply or by being removed from the group

Implements derecho::rpc::PendingBase.

Definition at line 472 of file rpc_utils.hpp.

◆ fulfill_map()

template<typename Ret>
void derecho::rpc::PendingResults< Ret >::fulfill_map ( const node_list_t who)
inlinevirtual

Fill pending_map and reply_promises with one promise/future pair for each node that was contacted in this RPC call.

Parameters
whoA list of nodes from which to expect responses.

Implements derecho::rpc::PendingBase.

Definition at line 390 of file rpc_utils.hpp.

◆ get_future()

template<typename Ret>
QueryResults<Ret> derecho::rpc::PendingResults< Ret >::get_future ( )
inline

Constructs and returns a QueryResults representing the "future" end of the response promises in this PendingResults.

Returns
A new QueryResults holding a set of futures for this RPC function call

Definition at line 381 of file rpc_utils.hpp.

◆ reset()

template<typename Ret>
void derecho::rpc::PendingResults< Ret >::reset ( )
inlinevirtual

reset this object.

Implements derecho::rpc::PendingBase.

Definition at line 479 of file rpc_utils.hpp.

◆ set_exception()

template<typename Ret>
void derecho::rpc::PendingResults< Ret >::set_exception ( const node_id_t nid,
const std::exception_ptr  e 
)
inline

Fulfills a promise for a single node's reply by setting an exception that was thrown by the RPC function call.

Parameters
nidThe node that responded to the RPC call with an exception
eThe exception_ptr that the RPC function call returned

Definition at line 460 of file rpc_utils.hpp.

◆ set_exception_for_caller_removed()

template<typename Ret>
void derecho::rpc::PendingResults< Ret >::set_exception_for_caller_removed ( )
inlinevirtual

Sets exceptions to indicate to the sender of this RPC call that it has been removed from its subgroup/shard, and can no longer expect responses.

Implements derecho::rpc::PendingBase.

Definition at line 408 of file rpc_utils.hpp.

◆ set_exception_for_removed_node()

template<typename Ret>
void derecho::rpc::PendingResults< Ret >::set_exception_for_removed_node ( const node_id_t removed_nid)
inlinevirtual

Implements derecho::rpc::PendingBase.

Definition at line 427 of file rpc_utils.hpp.

◆ set_value()

template<typename Ret>
void derecho::rpc::PendingResults< Ret >::set_value ( const node_id_t nid,
const Ret &  v 
)
inline

Fulfills a promise for a single node's reply by setting the value that the node returned for the RPC call.

Parameters
nidThe node that responded to the RPC call
vThe value that it returned as the result of the RPC function

Definition at line 443 of file rpc_utils.hpp.

Member Data Documentation

◆ dest_nodes

template<typename Ret>
std::set<node_id_t> derecho::rpc::PendingResults< Ret >::dest_nodes
private

Definition at line 369 of file rpc_utils.hpp.

◆ map_fulfilled

template<typename Ret>
bool derecho::rpc::PendingResults< Ret >::map_fulfilled = false
private

Definition at line 368 of file rpc_utils.hpp.

◆ promise_for_pending_map

template<typename Ret>
std::promise<std::unique_ptr<reply_map<Ret> > > derecho::rpc::PendingResults< Ret >::promise_for_pending_map
private

A promise for a map containing one future for each reply to the RPC function call.

The future end of this promise lives in QueryResults, and is fulfilled when the RPC function call is actually sent and the set of repliers is known.

Definition at line 358 of file rpc_utils.hpp.

◆ promise_for_reply_promises

template<typename Ret>
std::promise<std::map<node_id_t, std::promise<Ret> > > derecho::rpc::PendingResults< Ret >::promise_for_reply_promises
private

Definition at line 360 of file rpc_utils.hpp.

◆ reply_promises

template<typename Ret>
std::map<node_id_t, std::promise<Ret> > derecho::rpc::PendingResults< Ret >::reply_promises
private

Definition at line 366 of file rpc_utils.hpp.

◆ reply_promises_are_ready

template<typename Ret>
std::future<std::map<node_id_t, std::promise<Ret> > > derecho::rpc::PendingResults< Ret >::reply_promises_are_ready
private

A future for a map containing one promise for each reply to the RPC function call.

It will be fulfilled when fulfill_map is called, which means the RPC function call was actually sent and the set of destination nodes is known.

Definition at line 364 of file rpc_utils.hpp.

◆ reply_promises_are_ready_mutex

template<typename Ret>
std::mutex derecho::rpc::PendingResults< Ret >::reply_promises_are_ready_mutex
private

Definition at line 365 of file rpc_utils.hpp.

◆ responded_nodes

template<typename Ret>
std::set<node_id_t> derecho::rpc::PendingResults< Ret >::responded_nodes
private

Definition at line 369 of file rpc_utils.hpp.


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